aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/opp.c
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2013-09-19 17:03:50 -0400
committerRafael J. Wysocki <rjw@rjwysocki.net>2013-10-25 16:33:23 -0400
commit5d4879cda67b09f086807821cf594ee079d6dfbe (patch)
tree58532256e9bff42902510175e7cb7c727a89280b /drivers/base/power/opp.c
parent31d141e3a666269a3b6fcccddb0351caf7454240 (diff)
PM / OPP: rename functions to dev_pm_opp*
Since Operating Performance Points (OPP) functions are specific to device specific power management, be specific and rename opp_* accessors in OPP library with dev_pm_opp_* equivalent. Affected functions are: opp_get_voltage opp_get_freq opp_get_opp_count opp_find_freq_exact opp_find_freq_floor opp_find_freq_ceil opp_add opp_enable opp_disable opp_get_notifier opp_init_cpufreq_table opp_free_cpufreq_table Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power/opp.c')
-rw-r--r--drivers/base/power/opp.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index ef89897c6043..00c6a449cdeb 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -136,7 +136,7 @@ static struct device_opp *find_device_opp(struct device *dev)
136} 136}
137 137
138/** 138/**
139 * opp_get_voltage() - Gets the voltage corresponding to an available opp 139 * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an available opp
140 * @opp: opp for which voltage has to be returned for 140 * @opp: opp for which voltage has to be returned for
141 * 141 *
142 * Return voltage in micro volt corresponding to the opp, else 142 * Return voltage in micro volt corresponding to the opp, else
@@ -150,7 +150,7 @@ static struct device_opp *find_device_opp(struct device *dev)
150 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the 150 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
151 * pointer. 151 * pointer.
152 */ 152 */
153unsigned long opp_get_voltage(struct opp *opp) 153unsigned long dev_pm_opp_get_voltage(struct opp *opp)
154{ 154{
155 struct opp *tmp_opp; 155 struct opp *tmp_opp;
156 unsigned long v = 0; 156 unsigned long v = 0;
@@ -163,10 +163,10 @@ unsigned long opp_get_voltage(struct opp *opp)
163 163
164 return v; 164 return v;
165} 165}
166EXPORT_SYMBOL_GPL(opp_get_voltage); 166EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage);
167 167
168/** 168/**
169 * opp_get_freq() - Gets the frequency corresponding to an available opp 169 * dev_pm_opp_get_freq() - Gets the frequency corresponding to an available opp
170 * @opp: opp for which frequency has to be returned for 170 * @opp: opp for which frequency has to be returned for
171 * 171 *
172 * Return frequency in hertz corresponding to the opp, else 172 * Return frequency in hertz corresponding to the opp, else
@@ -180,7 +180,7 @@ EXPORT_SYMBOL_GPL(opp_get_voltage);
180 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the 180 * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
181 * pointer. 181 * pointer.
182 */ 182 */
183unsigned long opp_get_freq(struct opp *opp) 183unsigned long dev_pm_opp_get_freq(struct opp *opp)
184{ 184{
185 struct opp *tmp_opp; 185 struct opp *tmp_opp;
186 unsigned long f = 0; 186 unsigned long f = 0;
@@ -193,10 +193,10 @@ unsigned long opp_get_freq(struct opp *opp)
193 193
194 return f; 194 return f;
195} 195}
196EXPORT_SYMBOL_GPL(opp_get_freq); 196EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
197 197
198/** 198/**
199 * opp_get_opp_count() - Get number of opps available in the opp list 199 * dev_pm_opp_get_opp_count() - Get number of opps available in the opp list
200 * @dev: device for which we do this operation 200 * @dev: device for which we do this operation
201 * 201 *
202 * This function returns the number of available opps if there are any, 202 * This function returns the number of available opps if there are any,
@@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(opp_get_freq);
206 * internally references two RCU protected structures: device_opp and opp which 206 * internally references two RCU protected structures: device_opp and opp which
207 * are safe as long as we are under a common RCU locked section. 207 * are safe as long as we are under a common RCU locked section.
208 */ 208 */
209int opp_get_opp_count(struct device *dev) 209int dev_pm_opp_get_opp_count(struct device *dev)
210{ 210{
211 struct device_opp *dev_opp; 211 struct device_opp *dev_opp;
212 struct opp *temp_opp; 212 struct opp *temp_opp;
@@ -226,10 +226,10 @@ int opp_get_opp_count(struct device *dev)
226 226
227 return count; 227 return count;
228} 228}
229EXPORT_SYMBOL_GPL(opp_get_opp_count); 229EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count);
230 230
231/** 231/**
232 * opp_find_freq_exact() - search for an exact frequency 232 * dev_pm_opp_find_freq_exact() - search for an exact frequency
233 * @dev: device for which we do this operation 233 * @dev: device for which we do this operation
234 * @freq: frequency to search for 234 * @freq: frequency to search for
235 * @available: true/false - match for available opp 235 * @available: true/false - match for available opp
@@ -254,7 +254,7 @@ EXPORT_SYMBOL_GPL(opp_get_opp_count);
254 * under the locked area. The pointer returned must be used prior to unlocking 254 * under the locked area. The pointer returned must be used prior to unlocking
255 * with rcu_read_unlock() to maintain the integrity of the pointer. 255 * with rcu_read_unlock() to maintain the integrity of the pointer.
256 */ 256 */
257struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq, 257struct opp *dev_pm_opp_find_freq_exact(struct device *dev, unsigned long freq,
258 bool available) 258 bool available)
259{ 259{
260 struct device_opp *dev_opp; 260 struct device_opp *dev_opp;
@@ -277,10 +277,10 @@ struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq,
277 277
278 return opp; 278 return opp;
279} 279}
280EXPORT_SYMBOL_GPL(opp_find_freq_exact); 280EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact);
281 281
282/** 282/**
283 * opp_find_freq_ceil() - Search for an rounded ceil freq 283 * dev_pm_opp_find_freq_ceil() - Search for an rounded ceil freq
284 * @dev: device for which we do this operation 284 * @dev: device for which we do this operation
285 * @freq: Start frequency 285 * @freq: Start frequency
286 * 286 *
@@ -300,7 +300,7 @@ EXPORT_SYMBOL_GPL(opp_find_freq_exact);
300 * under the locked area. The pointer returned must be used prior to unlocking 300 * under the locked area. The pointer returned must be used prior to unlocking
301 * with rcu_read_unlock() to maintain the integrity of the pointer. 301 * with rcu_read_unlock() to maintain the integrity of the pointer.
302 */ 302 */
303struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq) 303struct opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq)
304{ 304{
305 struct device_opp *dev_opp; 305 struct device_opp *dev_opp;
306 struct opp *temp_opp, *opp = ERR_PTR(-ERANGE); 306 struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
@@ -324,10 +324,10 @@ struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq)
324 324
325 return opp; 325 return opp;
326} 326}
327EXPORT_SYMBOL_GPL(opp_find_freq_ceil); 327EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil);
328 328
329/** 329/**
330 * opp_find_freq_floor() - Search for a rounded floor freq 330 * dev_pm_opp_find_freq_floor() - Search for a rounded floor freq
331 * @dev: device for which we do this operation 331 * @dev: device for which we do this operation
332 * @freq: Start frequency 332 * @freq: Start frequency
333 * 333 *
@@ -347,7 +347,7 @@ EXPORT_SYMBOL_GPL(opp_find_freq_ceil);
347 * under the locked area. The pointer returned must be used prior to unlocking 347 * under the locked area. The pointer returned must be used prior to unlocking
348 * with rcu_read_unlock() to maintain the integrity of the pointer. 348 * with rcu_read_unlock() to maintain the integrity of the pointer.
349 */ 349 */
350struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq) 350struct opp *dev_pm_opp_find_freq_floor(struct device *dev, unsigned long *freq)
351{ 351{
352 struct device_opp *dev_opp; 352 struct device_opp *dev_opp;
353 struct opp *temp_opp, *opp = ERR_PTR(-ERANGE); 353 struct opp *temp_opp, *opp = ERR_PTR(-ERANGE);
@@ -375,17 +375,17 @@ struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq)
375 375
376 return opp; 376 return opp;
377} 377}
378EXPORT_SYMBOL_GPL(opp_find_freq_floor); 378EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor);
379 379
380/** 380/**
381 * opp_add() - Add an OPP table from a table definitions 381 * dev_pm_opp_add() - Add an OPP table from a table definitions
382 * @dev: device for which we do this operation 382 * @dev: device for which we do this operation
383 * @freq: Frequency in Hz for this OPP 383 * @freq: Frequency in Hz for this OPP
384 * @u_volt: Voltage in uVolts for this OPP 384 * @u_volt: Voltage in uVolts for this OPP
385 * 385 *
386 * This function adds an opp definition to the opp list and returns status. 386 * This function adds an opp definition to the opp list and returns status.
387 * The opp is made available by default and it can be controlled using 387 * The opp is made available by default and it can be controlled using
388 * opp_enable/disable functions. 388 * dev_pm_opp_enable/disable functions.
389 * 389 *
390 * Locking: The internal device_opp and opp structures are RCU protected. 390 * Locking: The internal device_opp and opp structures are RCU protected.
391 * Hence this function internally uses RCU updater strategy with mutex locks 391 * Hence this function internally uses RCU updater strategy with mutex locks
@@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(opp_find_freq_floor);
393 * that this function is *NOT* called under RCU protection or in contexts where 393 * that this function is *NOT* called under RCU protection or in contexts where
394 * mutex cannot be locked. 394 * mutex cannot be locked.
395 */ 395 */
396int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) 396int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
397{ 397{
398 struct device_opp *dev_opp = NULL; 398 struct device_opp *dev_opp = NULL;
399 struct opp *opp, *new_opp; 399 struct opp *opp, *new_opp;
@@ -460,7 +460,7 @@ int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
460 srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_ADD, new_opp); 460 srcu_notifier_call_chain(&dev_opp->head, OPP_EVENT_ADD, new_opp);
461 return 0; 461 return 0;
462} 462}
463EXPORT_SYMBOL_GPL(opp_add); 463EXPORT_SYMBOL_GPL(dev_pm_opp_add);
464 464
465/** 465/**
466 * opp_set_availability() - helper to set the availability of an opp 466 * opp_set_availability() - helper to set the availability of an opp
@@ -552,13 +552,13 @@ unlock:
552} 552}
553 553
554/** 554/**
555 * opp_enable() - Enable a specific OPP 555 * dev_pm_opp_enable() - Enable a specific OPP
556 * @dev: device for which we do this operation 556 * @dev: device for which we do this operation
557 * @freq: OPP frequency to enable 557 * @freq: OPP frequency to enable
558 * 558 *
559 * Enables a provided opp. If the operation is valid, this returns 0, else the 559 * Enables a provided opp. If the operation is valid, this returns 0, else the
560 * corresponding error value. It is meant to be used for users an OPP available 560 * corresponding error value. It is meant to be used for users an OPP available
561 * after being temporarily made unavailable with opp_disable. 561 * after being temporarily made unavailable with dev_pm_opp_disable.
562 * 562 *
563 * Locking: The internal device_opp and opp structures are RCU protected. 563 * Locking: The internal device_opp and opp structures are RCU protected.
564 * Hence this function indirectly uses RCU and mutex locks to keep the 564 * Hence this function indirectly uses RCU and mutex locks to keep the
@@ -566,21 +566,21 @@ unlock:
566 * this function is *NOT* called under RCU protection or in contexts where 566 * this function is *NOT* called under RCU protection or in contexts where
567 * mutex locking or synchronize_rcu() blocking calls cannot be used. 567 * mutex locking or synchronize_rcu() blocking calls cannot be used.
568 */ 568 */
569int opp_enable(struct device *dev, unsigned long freq) 569int dev_pm_opp_enable(struct device *dev, unsigned long freq)
570{ 570{
571 return opp_set_availability(dev, freq, true); 571 return opp_set_availability(dev, freq, true);
572} 572}
573EXPORT_SYMBOL_GPL(opp_enable); 573EXPORT_SYMBOL_GPL(dev_pm_opp_enable);
574 574
575/** 575/**
576 * opp_disable() - Disable a specific OPP 576 * dev_pm_opp_disable() - Disable a specific OPP
577 * @dev: device for which we do this operation 577 * @dev: device for which we do this operation
578 * @freq: OPP frequency to disable 578 * @freq: OPP frequency to disable
579 * 579 *
580 * Disables a provided opp. If the operation is valid, this returns 580 * Disables a provided opp. If the operation is valid, this returns
581 * 0, else the corresponding error value. It is meant to be a temporary 581 * 0, else the corresponding error value. It is meant to be a temporary
582 * control by users to make this OPP not available until the circumstances are 582 * control by users to make this OPP not available until the circumstances are
583 * right to make it available again (with a call to opp_enable). 583 * right to make it available again (with a call to dev_pm_opp_enable).
584 * 584 *
585 * Locking: The internal device_opp and opp structures are RCU protected. 585 * Locking: The internal device_opp and opp structures are RCU protected.
586 * Hence this function indirectly uses RCU and mutex locks to keep the 586 * Hence this function indirectly uses RCU and mutex locks to keep the
@@ -588,15 +588,15 @@ EXPORT_SYMBOL_GPL(opp_enable);
588 * this function is *NOT* called under RCU protection or in contexts where 588 * this function is *NOT* called under RCU protection or in contexts where
589 * mutex locking or synchronize_rcu() blocking calls cannot be used. 589 * mutex locking or synchronize_rcu() blocking calls cannot be used.
590 */ 590 */
591int opp_disable(struct device *dev, unsigned long freq) 591int dev_pm_opp_disable(struct device *dev, unsigned long freq)
592{ 592{
593 return opp_set_availability(dev, freq, false); 593 return opp_set_availability(dev, freq, false);
594} 594}
595EXPORT_SYMBOL_GPL(opp_disable); 595EXPORT_SYMBOL_GPL(dev_pm_opp_disable);
596 596
597#ifdef CONFIG_CPU_FREQ 597#ifdef CONFIG_CPU_FREQ
598/** 598/**
599 * opp_init_cpufreq_table() - create a cpufreq table for a device 599 * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device
600 * @dev: device for which we do this operation 600 * @dev: device for which we do this operation
601 * @table: Cpufreq table returned back to caller 601 * @table: Cpufreq table returned back to caller
602 * 602 *
@@ -619,7 +619,7 @@ EXPORT_SYMBOL_GPL(opp_disable);
619 * Callers should ensure that this function is *NOT* called under RCU protection 619 * Callers should ensure that this function is *NOT* called under RCU protection
620 * or in contexts where mutex locking cannot be used. 620 * or in contexts where mutex locking cannot be used.
621 */ 621 */
622int opp_init_cpufreq_table(struct device *dev, 622int dev_pm_opp_init_cpufreq_table(struct device *dev,
623 struct cpufreq_frequency_table **table) 623 struct cpufreq_frequency_table **table)
624{ 624{
625 struct device_opp *dev_opp; 625 struct device_opp *dev_opp;
@@ -639,7 +639,7 @@ int opp_init_cpufreq_table(struct device *dev,
639 } 639 }
640 640
641 freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) * 641 freq_table = kzalloc(sizeof(struct cpufreq_frequency_table) *
642 (opp_get_opp_count(dev) + 1), GFP_KERNEL); 642 (dev_pm_opp_get_opp_count(dev) + 1), GFP_KERNEL);
643 if (!freq_table) { 643 if (!freq_table) {
644 mutex_unlock(&dev_opp_list_lock); 644 mutex_unlock(&dev_opp_list_lock);
645 dev_warn(dev, "%s: Unable to allocate frequency table\n", 645 dev_warn(dev, "%s: Unable to allocate frequency table\n",
@@ -663,16 +663,16 @@ int opp_init_cpufreq_table(struct device *dev,
663 663
664 return 0; 664 return 0;
665} 665}
666EXPORT_SYMBOL_GPL(opp_init_cpufreq_table); 666EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table);
667 667
668/** 668/**
669 * opp_free_cpufreq_table() - free the cpufreq table 669 * dev_pm_opp_free_cpufreq_table() - free the cpufreq table
670 * @dev: device for which we do this operation 670 * @dev: device for which we do this operation
671 * @table: table to free 671 * @table: table to free
672 * 672 *
673 * Free up the table allocated by opp_init_cpufreq_table 673 * Free up the table allocated by dev_pm_opp_init_cpufreq_table
674 */ 674 */
675void opp_free_cpufreq_table(struct device *dev, 675void dev_pm_opp_free_cpufreq_table(struct device *dev,
676 struct cpufreq_frequency_table **table) 676 struct cpufreq_frequency_table **table)
677{ 677{
678 if (!table) 678 if (!table)
@@ -681,14 +681,14 @@ void opp_free_cpufreq_table(struct device *dev,
681 kfree(*table); 681 kfree(*table);
682 *table = NULL; 682 *table = NULL;
683} 683}
684EXPORT_SYMBOL_GPL(opp_free_cpufreq_table); 684EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table);
685#endif /* CONFIG_CPU_FREQ */ 685#endif /* CONFIG_CPU_FREQ */
686 686
687/** 687/**
688 * opp_get_notifier() - find notifier_head of the device with opp 688 * dev_pm_opp_get_notifier() - find notifier_head of the device with opp
689 * @dev: device pointer used to lookup device OPPs. 689 * @dev: device pointer used to lookup device OPPs.
690 */ 690 */
691struct srcu_notifier_head *opp_get_notifier(struct device *dev) 691struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev)
692{ 692{
693 struct device_opp *dev_opp = find_device_opp(dev); 693 struct device_opp *dev_opp = find_device_opp(dev);
694 694
@@ -732,7 +732,7 @@ int of_init_opp_table(struct device *dev)
732 unsigned long freq = be32_to_cpup(val++) * 1000; 732 unsigned long freq = be32_to_cpup(val++) * 1000;
733 unsigned long volt = be32_to_cpup(val++); 733 unsigned long volt = be32_to_cpup(val++);
734 734
735 if (opp_add(dev, freq, volt)) { 735 if (dev_pm_opp_add(dev, freq, volt)) {
736 dev_warn(dev, "%s: Failed to add OPP %ld\n", 736 dev_warn(dev, "%s: Failed to add OPP %ld\n",
737 __func__, freq); 737 __func__, freq);
738 continue; 738 continue;