Commit 47d43ba73eb98d8ba731208735c899129d9849e1

Authored by Nishanth Menon
Committed by Rafael J. Wysocki
1 parent 5d4879cda6

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: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Showing 12 changed files with 60 additions and 53 deletions Side-by-side Diff

Documentation/power/opp.txt
... ... @@ -358,14 +358,14 @@
358 358 representing the actual OPPs and domains are internal to the OPP library itself
359 359 to allow for suitable abstraction reusable across systems.
360 360  
361   -struct opp - The internal data structure of OPP library which is used to
  361 +struct dev_pm_opp - The internal data structure of OPP library which is used to
362 362 represent an OPP. In addition to the freq, voltage, availability
363 363 information, it also contains internal book keeping information required
364 364 for the OPP library to operate on. Pointer to this structure is
365 365 provided back to the users such as SoC framework to be used as a
366 366 identifier for OPP in the interactions with OPP layer.
367 367  
368   - WARNING: The struct opp pointer should not be parsed or modified by the
  368 + WARNING: The struct dev_pm_opp pointer should not be parsed or modified by the
369 369 users. The defaults of for an instance is populated by dev_pm_opp_add, but the
370 370 availability of the OPP can be modified by dev_pm_opp_enable/disable functions.
371 371  
arch/arm/mach-omap2/pm.c
... ... @@ -131,7 +131,7 @@
131 131 {
132 132 struct voltagedomain *voltdm;
133 133 struct clk *clk;
134   - struct opp *opp;
  134 + struct dev_pm_opp *opp;
135 135 unsigned long freq, bootup_volt;
136 136 struct device *dev;
137 137  
drivers/base/power/opp.c
... ... @@ -42,7 +42,7 @@
42 42 */
43 43  
44 44 /**
45   - * struct opp - Generic OPP description structure
  45 + * struct dev_pm_opp - Generic OPP description structure
46 46 * @node: opp list node. The nodes are maintained throughout the lifetime
47 47 * of boot. It is expected only an optimal set of OPPs are
48 48 * added to the library by the SoC framework.
... ... @@ -59,7 +59,7 @@
59 59 *
60 60 * This structure stores the OPP information for a given device.
61 61 */
62   -struct opp {
  62 +struct dev_pm_opp {
63 63 struct list_head node;
64 64  
65 65 bool available;
66 66  
... ... @@ -150,9 +150,9 @@
150 150 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
151 151 * pointer.
152 152 */
153   -unsigned long dev_pm_opp_get_voltage(struct opp *opp)
  153 +unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
154 154 {
155   - struct opp *tmp_opp;
  155 + struct dev_pm_opp *tmp_opp;
156 156 unsigned long v = 0;
157 157  
158 158 tmp_opp = rcu_dereference(opp);
159 159  
... ... @@ -180,9 +180,9 @@
180 180 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
181 181 * pointer.
182 182 */
183   -unsigned long dev_pm_opp_get_freq(struct opp *opp)
  183 +unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
184 184 {
185   - struct opp *tmp_opp;
  185 + struct dev_pm_opp *tmp_opp;
186 186 unsigned long f = 0;
187 187  
188 188 tmp_opp = rcu_dereference(opp);
... ... @@ -209,7 +209,7 @@
209 209 int dev_pm_opp_get_opp_count(struct device *dev)
210 210 {
211 211 struct device_opp *dev_opp;
212   - struct opp *temp_opp;
  212 + struct dev_pm_opp *temp_opp;
213 213 int count = 0;
214 214  
215 215 dev_opp = find_device_opp(dev);
216 216  
... ... @@ -254,11 +254,12 @@
254 254 * under the locked area. The pointer returned must be used prior to unlocking
255 255 * with rcu_read_unlock() to maintain the integrity of the pointer.
256 256 */
257   -struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
258   - bool available)
  257 +struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
  258 + unsigned long freq,
  259 + bool available)
259 260 {
260 261 struct device_opp *dev_opp;
261   - struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
  262 + struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);
262 263  
263 264 dev_opp = find_device_opp(dev);
264 265 if (IS_ERR(dev_opp)) {
265 266  
... ... @@ -300,10 +301,11 @@
300 301 * under the locked area. The pointer returned must be used prior to unlocking
301 302 * with rcu_read_unlock() to maintain the integrity of the pointer.
302 303 */
303   -struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq)
  304 +struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
  305 + unsigned long *freq)
304 306 {
305 307 struct device_opp *dev_opp;
306   - struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
  308 + struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);
307 309  
308 310 if (!dev || !freq) {
309 311 dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq);
310 312  
... ... @@ -347,10 +349,11 @@
347 349 * under the locked area. The pointer returned must be used prior to unlocking
348 350 * with rcu_read_unlock() to maintain the integrity of the pointer.
349 351 */
350   -struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq)
  352 +struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
  353 + unsigned long *freq)
351 354 {
352 355 struct device_opp *dev_opp;
353   - struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
  356 + struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE);
354 357  
355 358 if (!dev || !freq) {
356 359 dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq);
357 360  
... ... @@ -396,11 +399,11 @@
396 399 int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
397 400 {
398 401 struct device_opp *dev_opp = NULL;
399   - struct opp *opp, *new_opp;
  402 + struct dev_pm_opp *opp, *new_opp;
400 403 struct list_head *head;
401 404  
402 405 /* allocate new OPP node */
403   - new_opp = kzalloc(sizeof(struct opp), GFP_KERNEL);
  406 + new_opp = kzalloc(sizeof(*new_opp), GFP_KERNEL);
404 407 if (!new_opp) {
405 408 dev_warn(dev, "%s: Unable to create new OPP node\n", __func__);
406 409 return -ENOMEM;
407 410  
... ... @@ -485,11 +488,11 @@
485 488 bool availability_req)
486 489 {
487 490 struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV);
488   - struct opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
  491 + struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
489 492 int r = 0;
490 493  
491 494 /* keep the node allocated */
492   - new_opp = kmalloc(sizeof(struct opp), GFP_KERNEL);
  495 + new_opp = kmalloc(sizeof(*new_opp), GFP_KERNEL);
493 496 if (!new_opp) {
494 497 dev_warn(dev, "%s: Unable to create OPP\n", __func__);
495 498 return -ENOMEM;
... ... @@ -623,7 +626,7 @@
623 626 struct cpufreq_frequency_table **table)
624 627 {
625 628 struct device_opp *dev_opp;
626   - struct opp *opp;
  629 + struct dev_pm_opp *opp;
627 630 struct cpufreq_frequency_table *freq_table;
628 631 int i = 0;
629 632  
drivers/cpufreq/cpufreq-cpu0.c
... ... @@ -44,7 +44,7 @@
44 44 unsigned int target_freq, unsigned int relation)
45 45 {
46 46 struct cpufreq_freqs freqs;
47   - struct opp *opp;
  47 + struct dev_pm_opp *opp;
48 48 unsigned long volt = 0, volt_old = 0, tol = 0;
49 49 long freq_Hz, freq_exact;
50 50 unsigned int index;
... ... @@ -230,7 +230,7 @@
230 230 transition_latency = CPUFREQ_ETERNAL;
231 231  
232 232 if (!IS_ERR(cpu_reg)) {
233   - struct opp *opp;
  233 + struct dev_pm_opp *opp;
234 234 unsigned long min_uV, max_uV;
235 235 int i;
236 236  
drivers/cpufreq/exynos5440-cpufreq.c
... ... @@ -118,7 +118,7 @@
118 118 struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
119 119 unsigned int tmp, clk_div, ema_div, freq, volt_id;
120 120 int i = 0;
121   - struct opp *opp;
  121 + struct dev_pm_opp *opp;
122 122  
123 123 rcu_read_lock();
124 124 for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
drivers/cpufreq/imx6q-cpufreq.c
... ... @@ -49,7 +49,7 @@
49 49 unsigned int target_freq, unsigned int relation)
50 50 {
51 51 struct cpufreq_freqs freqs;
52   - struct opp *opp;
  52 + struct dev_pm_opp *opp;
53 53 unsigned long freq_hz, volt, volt_old;
54 54 unsigned int index;
55 55 int ret;
... ... @@ -199,7 +199,7 @@
199 199 static int imx6q_cpufreq_probe(struct platform_device *pdev)
200 200 {
201 201 struct device_node *np;
202   - struct opp *opp;
  202 + struct dev_pm_opp *opp;
203 203 unsigned long min_volt, max_volt;
204 204 int num, ret;
205 205  
drivers/cpufreq/omap-cpufreq.c
... ... @@ -65,7 +65,7 @@
65 65 unsigned int i;
66 66 int r, ret = 0;
67 67 struct cpufreq_freqs freqs;
68   - struct opp *opp;
  68 + struct dev_pm_opp *opp;
69 69 unsigned long freq, volt = 0, volt_old = 0, tol = 0;
70 70  
71 71 if (!freq_table) {
drivers/devfreq/devfreq.c
... ... @@ -902,7 +902,7 @@
902 902 {
903 903 struct devfreq *df = to_devfreq(d);
904 904 struct device *dev = df->dev.parent;
905   - struct opp *opp;
  905 + struct dev_pm_opp *opp;
906 906 ssize_t count = 0;
907 907 unsigned long freq = 0;
908 908  
909 909  
... ... @@ -1029,10 +1029,11 @@
1029 1029 * under the locked area. The pointer returned must be used prior to unlocking
1030 1030 * with rcu_read_unlock() to maintain the integrity of the pointer.
1031 1031 */
1032   -struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
1033   - u32 flags)
  1032 +struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
  1033 + unsigned long *freq,
  1034 + u32 flags)
1034 1035 {
1035   - struct opp *opp;
  1036 + struct dev_pm_opp *opp;
1036 1037  
1037 1038 if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
1038 1039 /* The freq is an upper bound. opp should be lower */
drivers/devfreq/exynos/exynos4_bus.c
... ... @@ -639,7 +639,7 @@
639 639 struct platform_device *pdev = container_of(dev, struct platform_device,
640 640 dev);
641 641 struct busfreq_data *data = platform_get_drvdata(pdev);
642   - struct opp *opp;
  642 + struct dev_pm_opp *opp;
643 643 unsigned long freq;
644 644 unsigned long old_freq = data->curr_oppinfo.rate;
645 645 struct busfreq_opp_info new_oppinfo;
... ... @@ -956,7 +956,7 @@
956 956 {
957 957 struct busfreq_data *data = container_of(this, struct busfreq_data,
958 958 pm_notifier);
959   - struct opp *opp;
  959 + struct dev_pm_opp *opp;
960 960 struct busfreq_opp_info new_oppinfo;
961 961 unsigned long maxfreq = ULONG_MAX;
962 962 int err = 0;
... ... @@ -1020,7 +1020,7 @@
1020 1020 static int exynos4_busfreq_probe(struct platform_device *pdev)
1021 1021 {
1022 1022 struct busfreq_data *data;
1023   - struct opp *opp;
  1023 + struct dev_pm_opp *opp;
1024 1024 struct device *dev = &pdev->dev;
1025 1025 int err = 0;
1026 1026  
drivers/devfreq/exynos/exynos5_bus.c
... ... @@ -132,7 +132,7 @@
132 132 struct platform_device *pdev = container_of(dev, struct platform_device,
133 133 dev);
134 134 struct busfreq_data_int *data = platform_get_drvdata(pdev);
135   - struct opp *opp;
  135 + struct dev_pm_opp *opp;
136 136 unsigned long old_freq, freq;
137 137 unsigned long volt;
138 138  
... ... @@ -262,7 +262,7 @@
262 262 {
263 263 struct busfreq_data_int *data = container_of(this,
264 264 struct busfreq_data_int, pm_notifier);
265   - struct opp *opp;
  265 + struct dev_pm_opp *opp;
266 266 unsigned long maxfreq = ULONG_MAX;
267 267 unsigned long freq;
268 268 unsigned long volt;
... ... @@ -316,7 +316,7 @@
316 316 static int exynos5_busfreq_int_probe(struct platform_device *pdev)
317 317 {
318 318 struct busfreq_data_int *data;
319   - struct opp *opp;
  319 + struct dev_pm_opp *opp;
320 320 struct device *dev = &pdev->dev;
321 321 struct device_node *np;
322 322 unsigned long initial_freq;
include/linux/devfreq.h
... ... @@ -187,7 +187,7 @@
187 187 extern int devfreq_resume_device(struct devfreq *devfreq);
188 188  
189 189 /* Helper functions for devfreq user device driver with OPP. */
190   -extern struct opp *devfreq_recommended_opp(struct device *dev,
  190 +extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
191 191 unsigned long *freq, u32 flags);
192 192 extern int devfreq_register_opp_notifier(struct device *dev,
193 193 struct devfreq *devfreq);
... ... @@ -238,7 +238,7 @@
238 238 return 0;
239 239 }
240 240  
241   -static inline struct opp *devfreq_recommended_opp(struct device *dev,
  241 +static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
242 242 unsigned long *freq, u32 flags)
243 243 {
244 244 return ERR_PTR(-EINVAL);
... ... @@ -18,27 +18,30 @@
18 18 #include <linux/cpufreq.h>
19 19 #include <linux/notifier.h>
20 20  
21   -struct opp;
  21 +struct dev_pm_opp;
22 22 struct device;
23 23  
24   -enum opp_event {
  24 +enum dev_pm_opp_event {
25 25 OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
26 26 };
27 27  
28 28 #if defined(CONFIG_PM_OPP)
29 29  
30   -unsigned long dev_pm_opp_get_voltage(struct opp *opp);
  30 +unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
31 31  
32   -unsigned long dev_pm_opp_get_freq(struct opp *opp);
  32 +unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
33 33  
34 34 int dev_pm_opp_get_opp_count(struct device *dev);
35 35  
36   -struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
37   - bool available);
  36 +struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
  37 + unsigned long freq,
  38 + bool available);
38 39  
39   -struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq);
  40 +struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
  41 + unsigned long *freq);
40 42  
41   -struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq);
  43 +struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
  44 + unsigned long *freq);
42 45  
43 46 int dev_pm_opp_add(struct device *dev, unsigned long freq,
44 47 unsigned long u_volt);
45 48  
... ... @@ -49,12 +52,12 @@
49 52  
50 53 struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev);
51 54 #else
52   -static inline unsigned long dev_pm_opp_get_voltage(struct opp *opp)
  55 +static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
53 56 {
54 57 return 0;
55 58 }
56 59  
57   -static inline unsigned long dev_pm_opp_get_freq(struct opp *opp)
  60 +static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
58 61 {
59 62 return 0;
60 63 }
61 64  
62 65  
... ... @@ -64,19 +67,19 @@
64 67 return 0;
65 68 }
66 69  
67   -static inline struct opp *dev_pm_opp_find_freq_exact(struct device *dev,
  70 +static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
68 71 unsigned long freq, bool available)
69 72 {
70 73 return ERR_PTR(-EINVAL);
71 74 }
72 75  
73   -static inline struct opp *dev_pm_opp_find_freq_floor(struct device *dev,
  76 +static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
74 77 unsigned long *freq)
75 78 {
76 79 return ERR_PTR(-EINVAL);
77 80 }
78 81  
79   -static inline struct opp *dev_pm_opp_find_freq_ceil(struct device *dev,
  82 +static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
80 83 unsigned long *freq)
81 84 {
82 85 return ERR_PTR(-EINVAL);