Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47d43ba7 authored by Nishanth Menon's avatar Nishanth Menon Committed by Rafael J. Wysocki
Browse files

PM / OPP: rename data structures to dev_pm equivalents



Since Operating Performance Points (OPP) data structures are specific
to device specific power management, be specific and rename opp_* data
structures in OPP library with dev_pm_opp_* equivalent.

Affected structures are:
 struct opp
 enum opp_event

Minor checkpatch warning resulting of this change was fixed as well.

Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarNishanth Menon <nm@ti.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 5d4879cd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -358,14 +358,14 @@ accessed by various functions as described above. However, the structures
representing the actual OPPs and domains are internal to the OPP library itself
to allow for suitable abstraction reusable across systems.

struct opp - The internal data structure of OPP library which is used to
struct dev_pm_opp - The internal data structure of OPP library which is used to
	represent an OPP. In addition to the freq, voltage, availability
	information, it also contains internal book keeping information required
	for the OPP library to operate on.  Pointer to this structure is
	provided back to the users such as SoC framework to be used as a
	identifier for OPP in the interactions with OPP layer.

	WARNING: The struct opp pointer should not be parsed or modified by the
	WARNING: The struct dev_pm_opp pointer should not be parsed or modified by the
	users. The defaults of for an instance is populated by dev_pm_opp_add, but the
	availability of the OPP can be modified by dev_pm_opp_enable/disable functions.

+1 −1
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
{
	struct voltagedomain *voltdm;
	struct clk *clk;
	struct opp *opp;
	struct dev_pm_opp *opp;
	unsigned long freq, bootup_volt;
	struct device *dev;

+22 −19
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
 */

/**
 * struct opp - Generic OPP description structure
 * struct dev_pm_opp - Generic OPP description structure
 * @node:	opp list node. The nodes are maintained throughout the lifetime
 *		of boot. It is expected only an optimal set of OPPs are
 *		added to the library by the SoC framework.
@@ -59,7 +59,7 @@
 *
 * This structure stores the OPP information for a given device.
 */
struct opp {
struct dev_pm_opp {
	struct list_head node;

	bool available;
@@ -150,9 +150,9 @@ static struct device_opp *find_device_opp(struct device *dev)
 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
 * pointer.
 */
unsigned long dev_pm_opp_get_voltage(struct opp *opp)
unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
{
	struct opp *tmp_opp;
	struct dev_pm_opp *tmp_opp;
	unsigned long v = 0;

	tmp_opp = rcu_dereference(opp);
@@ -180,9 +180,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage);
 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
 * pointer.
 */
unsigned long dev_pm_opp_get_freq(struct opp *opp)
unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
{
	struct opp *tmp_opp;
	struct dev_pm_opp *tmp_opp;
	unsigned long f = 0;

	tmp_opp = rcu_dereference(opp);
@@ -209,7 +209,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
int dev_pm_opp_get_opp_count(struct device *dev)
{
	struct device_opp *dev_opp;
	struct opp *temp_opp;
	struct dev_pm_opp *temp_opp;
	int count = 0;

	dev_opp = find_device_opp(dev);
@@ -254,11 +254,12 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count);
 * under the locked area. The pointer returned must be used prior to unlocking
 * with rcu_read_unlock() to maintain the integrity of the pointer.
 */
struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
					      unsigned long freq,
					      bool available)
{
	struct device_opp *dev_opp;
	struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
	struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);

	dev_opp = find_device_opp(dev);
	if (IS_ERR(dev_opp)) {
@@ -300,10 +301,11 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact);
 * under the locked area. The pointer returned must be used prior to unlocking
 * with rcu_read_unlock() to maintain the integrity of the pointer.
 */
struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq)
struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
					     unsigned long *freq)
{
	struct device_opp *dev_opp;
	struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
	struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);

	if (!dev || !freq) {
		dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq);
@@ -347,10 +349,11 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil);
 * under the locked area. The pointer returned must be used prior to unlocking
 * with rcu_read_unlock() to maintain the integrity of the pointer.
 */
struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq)
struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
					      unsigned long *freq)
{
	struct device_opp *dev_opp;
	struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
	struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);

	if (!dev || !freq) {
		dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq);
@@ -396,11 +399,11 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor);
int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
{
	struct device_opp *dev_opp = NULL;
	struct opp *opp, *new_opp;
	struct dev_pm_opp *opp, *new_opp;
	struct list_head *head;

	/* allocate new OPP node */
	new_opp = kzalloc(sizeof(struct opp), GFP_KERNEL);
	new_opp = kzalloc(sizeof(*new_opp), GFP_KERNEL);
	if (!new_opp) {
		dev_warn(dev, "%s: Unable to create new OPP node\n", __func__);
		return -ENOMEM;
@@ -485,11 +488,11 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
		bool availability_req)
{
	struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV);
	struct opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
	struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
	int r = 0;

	/* keep the node allocated */
	new_opp = kmalloc(sizeof(struct opp), GFP_KERNEL);
	new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL);
	if (!new_opp) {
		dev_warn(dev, "%s: Unable to create OPP\n", __func__);
		return -ENOMEM;
@@ -623,7 +626,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev,
			    struct cpufreq_frequency_table **table)
{
	struct device_opp *dev_opp;
	struct opp *opp;
	struct dev_pm_opp *opp;
	struct cpufreq_frequency_table *freq_table;
	int i = 0;

+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
			   unsigned int target_freq, unsigned int relation)
{
	struct cpufreq_freqs freqs;
	struct opp *opp;
	struct dev_pm_opp *opp;
	unsigned long volt = 0, volt_old = 0, tol = 0;
	long freq_Hz, freq_exact;
	unsigned int index;
@@ -230,7 +230,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
		transition_latency = CPUFREQ_ETERNAL;

	if (!IS_ERR(cpu_reg)) {
		struct opp *opp;
		struct dev_pm_opp *opp;
		unsigned long min_uV, max_uV;
		int i;

+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ static int init_div_table(void)
	struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
	unsigned int tmp, clk_div, ema_div, freq, volt_id;
	int i = 0;
	struct opp *opp;
	struct dev_pm_opp *opp;

	rcu_read_lock();
	for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
Loading