aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/power/opp.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 435c94e93263..f4aa85a72d36 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -117,7 +117,7 @@ do { \
117} while (0) 117} while (0)
118 118
119/** 119/**
120 * find_device_opp() - find device_opp struct using device pointer 120 * _find_device_opp() - find device_opp struct using device pointer
121 * @dev: device pointer used to lookup device OPPs 121 * @dev: device pointer used to lookup device OPPs
122 * 122 *
123 * Search list of device OPPs for one containing matching device. Does a RCU 123 * Search list of device OPPs for one containing matching device. Does a RCU
@@ -130,7 +130,7 @@ do { \
130 * is a RCU protected pointer. This means that device_opp is valid as long 130 * is a RCU protected pointer. This means that device_opp is valid as long
131 * as we are under RCU lock. 131 * as we are under RCU lock.
132 */ 132 */
133static struct device_opp *find_device_opp(struct device *dev) 133static struct device_opp *_find_device_opp(struct device *dev)
134{ 134{
135 struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV); 135 struct device_opp *tmp_dev_opp, *dev_opp = ERR_PTR(-ENODEV);
136 136
@@ -226,7 +226,7 @@ int dev_pm_opp_get_opp_count(struct device *dev)
226 226
227 rcu_read_lock(); 227 rcu_read_lock();
228 228
229 dev_opp = find_device_opp(dev); 229 dev_opp = _find_device_opp(dev);
230 if (IS_ERR(dev_opp)) { 230 if (IS_ERR(dev_opp)) {
231 count = PTR_ERR(dev_opp); 231 count = PTR_ERR(dev_opp);
232 dev_err(dev, "%s: device OPP not found (%d)\n", 232 dev_err(dev, "%s: device OPP not found (%d)\n",
@@ -280,7 +280,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
280 280
281 opp_rcu_lockdep_assert(); 281 opp_rcu_lockdep_assert();
282 282
283 dev_opp = find_device_opp(dev); 283 dev_opp = _find_device_opp(dev);
284 if (IS_ERR(dev_opp)) { 284 if (IS_ERR(dev_opp)) {
285 int r = PTR_ERR(dev_opp); 285 int r = PTR_ERR(dev_opp);
286 dev_err(dev, "%s: device OPP not found (%d)\n", __func__, r); 286 dev_err(dev, "%s: device OPP not found (%d)\n", __func__, r);
@@ -333,7 +333,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
333 return ERR_PTR(-EINVAL); 333 return ERR_PTR(-EINVAL);
334 } 334 }
335 335
336 dev_opp = find_device_opp(dev); 336 dev_opp = _find_device_opp(dev);
337 if (IS_ERR(dev_opp)) 337 if (IS_ERR(dev_opp))
338 return ERR_CAST(dev_opp); 338 return ERR_CAST(dev_opp);
339 339
@@ -383,7 +383,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
383 return ERR_PTR(-EINVAL); 383 return ERR_PTR(-EINVAL);
384 } 384 }
385 385
386 dev_opp = find_device_opp(dev); 386 dev_opp = _find_device_opp(dev);
387 if (IS_ERR(dev_opp)) 387 if (IS_ERR(dev_opp))
388 return ERR_CAST(dev_opp); 388 return ERR_CAST(dev_opp);
389 389
@@ -403,7 +403,7 @@ struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
403} 403}
404EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor); 404EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor);
405 405
406static struct device_opp *add_device_opp(struct device *dev) 406static struct device_opp *_add_device_opp(struct device *dev)
407{ 407{
408 struct device_opp *dev_opp; 408 struct device_opp *dev_opp;
409 409
@@ -424,8 +424,8 @@ static struct device_opp *add_device_opp(struct device *dev)
424 return dev_opp; 424 return dev_opp;
425} 425}
426 426
427static int dev_pm_opp_add_dynamic(struct device *dev, unsigned long freq, 427static int _opp_add_dynamic(struct device *dev, unsigned long freq,
428 unsigned long u_volt, bool dynamic) 428 long u_volt, bool dynamic)
429{ 429{
430 struct device_opp *dev_opp = NULL; 430 struct device_opp *dev_opp = NULL;
431 struct dev_pm_opp *opp, *new_opp; 431 struct dev_pm_opp *opp, *new_opp;
@@ -449,9 +449,9 @@ static int dev_pm_opp_add_dynamic(struct device *dev, unsigned long freq,
449 new_opp->dynamic = dynamic; 449 new_opp->dynamic = dynamic;
450 450
451 /* Check for existing list for 'dev' */ 451 /* Check for existing list for 'dev' */
452 dev_opp = find_device_opp(dev); 452 dev_opp = _find_device_opp(dev);
453 if (IS_ERR(dev_opp)) { 453 if (IS_ERR(dev_opp)) {
454 dev_opp = add_device_opp(dev); 454 dev_opp = _add_device_opp(dev);
455 if (!dev_opp) { 455 if (!dev_opp) {
456 ret = -ENOMEM; 456 ret = -ENOMEM;
457 goto free_opp; 457 goto free_opp;
@@ -527,26 +527,26 @@ free_opp:
527 */ 527 */
528int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) 528int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
529{ 529{
530 return dev_pm_opp_add_dynamic(dev, freq, u_volt, true); 530 return _opp_add_dynamic(dev, freq, u_volt, true);
531} 531}
532EXPORT_SYMBOL_GPL(dev_pm_opp_add); 532EXPORT_SYMBOL_GPL(dev_pm_opp_add);
533 533
534static void kfree_opp_rcu(struct rcu_head *head) 534static void _kfree_opp_rcu(struct rcu_head *head)
535{ 535{
536 struct dev_pm_opp *opp = container_of(head, struct dev_pm_opp, rcu_head); 536 struct dev_pm_opp *opp = container_of(head, struct dev_pm_opp, rcu_head);
537 537
538 kfree_rcu(opp, rcu_head); 538 kfree_rcu(opp, rcu_head);
539} 539}
540 540
541static void kfree_device_rcu(struct rcu_head *head) 541static void _kfree_device_rcu(struct rcu_head *head)
542{ 542{
543 struct device_opp *device_opp = container_of(head, struct device_opp, rcu_head); 543 struct device_opp *device_opp = container_of(head, struct device_opp, rcu_head);
544 544
545 kfree_rcu(device_opp, rcu_head); 545 kfree_rcu(device_opp, rcu_head);
546} 546}
547 547
548static void __dev_pm_opp_remove(struct device_opp *dev_opp, 548static void _opp_remove(struct device_opp *dev_opp,
549 struct dev_pm_opp *opp) 549 struct dev_pm_opp *opp)
550{ 550{
551 /* 551 /*
552 * Notify the changes in the availability of the operable 552 * Notify the changes in the availability of the operable
@@ -554,12 +554,12 @@ static void __dev_pm_opp_remove(struct device_opp *dev_opp,
554 */ 554 */
555 srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_REMOVE, opp); 555 srcu_notifier_call_chain(&dev_opp->srcu_head, OPP_EVENT_REMOVE, opp);
556 list_del_rcu(&opp->node); 556 list_del_rcu(&opp->node);
557 call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu); 557 call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu);
558 558
559 if (list_empty(&dev_opp->opp_list)) { 559 if (list_empty(&dev_opp->opp_list)) {
560 list_del_rcu(&dev_opp->node); 560 list_del_rcu(&dev_opp->node);
561 call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head, 561 call_srcu(&dev_opp->srcu_head.srcu, &dev_opp->rcu_head,
562 kfree_device_rcu); 562 _kfree_device_rcu);
563 } 563 }
564} 564}
565 565
@@ -579,7 +579,7 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq)
579 /* Hold our list modification lock here */ 579 /* Hold our list modification lock here */
580 mutex_lock(&dev_opp_list_lock); 580 mutex_lock(&dev_opp_list_lock);
581 581
582 dev_opp = find_device_opp(dev); 582 dev_opp = _find_device_opp(dev);
583 if (IS_ERR(dev_opp)) 583 if (IS_ERR(dev_opp))
584 goto unlock; 584 goto unlock;
585 585
@@ -596,14 +596,14 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq)
596 goto unlock; 596 goto unlock;
597 } 597 }
598 598
599 __dev_pm_opp_remove(dev_opp, opp); 599 _opp_remove(dev_opp, opp);
600unlock: 600unlock:
601 mutex_unlock(&dev_opp_list_lock); 601 mutex_unlock(&dev_opp_list_lock);
602} 602}
603EXPORT_SYMBOL_GPL(dev_pm_opp_remove); 603EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
604 604
605/** 605/**
606 * opp_set_availability() - helper to set the availability of an opp 606 * _opp_set_availability() - helper to set the availability of an opp
607 * @dev: device for which we do this operation 607 * @dev: device for which we do this operation
608 * @freq: OPP frequency to modify availability 608 * @freq: OPP frequency to modify availability
609 * @availability_req: availability status requested for this opp 609 * @availability_req: availability status requested for this opp
@@ -621,8 +621,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
621 * that this function is *NOT* called under RCU protection or in contexts where 621 * that this function is *NOT* called under RCU protection or in contexts where
622 * mutex locking or synchronize_rcu() blocking calls cannot be used. 622 * mutex locking or synchronize_rcu() blocking calls cannot be used.
623 */ 623 */
624static int opp_set_availability(struct device *dev, unsigned long freq, 624static int _opp_set_availability(struct device *dev, unsigned long freq,
625 bool availability_req) 625 bool availability_req)
626{ 626{
627 struct device_opp *dev_opp; 627 struct device_opp *dev_opp;
628 struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV); 628 struct dev_pm_opp *new_opp, *tmp_opp, *opp = ERR_PTR(-ENODEV);
@@ -638,7 +638,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
638 mutex_lock(&dev_opp_list_lock); 638 mutex_lock(&dev_opp_list_lock);
639 639
640 /* Find the device_opp */ 640 /* Find the device_opp */
641 dev_opp = find_device_opp(dev); 641 dev_opp = _find_device_opp(dev);
642 if (IS_ERR(dev_opp)) { 642 if (IS_ERR(dev_opp)) {
643 r = PTR_ERR(dev_opp); 643 r = PTR_ERR(dev_opp);
644 dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r); 644 dev_warn(dev, "%s: Device OPP not found (%d)\n", __func__, r);
@@ -668,7 +668,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq,
668 668
669 list_replace_rcu(&opp->node, &new_opp->node); 669 list_replace_rcu(&opp->node, &new_opp->node);
670 mutex_unlock(&dev_opp_list_lock); 670 mutex_unlock(&dev_opp_list_lock);
671 call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, kfree_opp_rcu); 671 call_srcu(&dev_opp->srcu_head.srcu, &opp->rcu_head, _kfree_opp_rcu);
672 672
673 /* Notify the change of the OPP availability */ 673 /* Notify the change of the OPP availability */
674 if (availability_req) 674 if (availability_req)
@@ -703,7 +703,7 @@ unlock:
703 */ 703 */
704int dev_pm_opp_enable(struct device *dev, unsigned long freq) 704int dev_pm_opp_enable(struct device *dev, unsigned long freq)
705{ 705{
706 return opp_set_availability(dev, freq, true); 706 return _opp_set_availability(dev, freq, true);
707} 707}
708EXPORT_SYMBOL_GPL(dev_pm_opp_enable); 708EXPORT_SYMBOL_GPL(dev_pm_opp_enable);
709 709
@@ -725,7 +725,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_enable);
725 */ 725 */
726int dev_pm_opp_disable(struct device *dev, unsigned long freq) 726int dev_pm_opp_disable(struct device *dev, unsigned long freq)
727{ 727{
728 return opp_set_availability(dev, freq, false); 728 return _opp_set_availability(dev, freq, false);
729} 729}
730EXPORT_SYMBOL_GPL(dev_pm_opp_disable); 730EXPORT_SYMBOL_GPL(dev_pm_opp_disable);
731 731
@@ -735,7 +735,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_disable);
735 */ 735 */
736struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev) 736struct srcu_notifier_head *dev_pm_opp_get_notifier(struct device *dev)
737{ 737{
738 struct device_opp *dev_opp = find_device_opp(dev); 738 struct device_opp *dev_opp = _find_device_opp(dev);
739 739
740 if (IS_ERR(dev_opp)) 740 if (IS_ERR(dev_opp))
741 return ERR_CAST(dev_opp); /* matching type */ 741 return ERR_CAST(dev_opp); /* matching type */
@@ -778,7 +778,7 @@ int of_init_opp_table(struct device *dev)
778 unsigned long freq = be32_to_cpup(val++) * 1000; 778 unsigned long freq = be32_to_cpup(val++) * 1000;
779 unsigned long volt = be32_to_cpup(val++); 779 unsigned long volt = be32_to_cpup(val++);
780 780
781 if (dev_pm_opp_add_dynamic(dev, freq, volt, false)) 781 if (_opp_add_dynamic(dev, freq, volt, false))
782 dev_warn(dev, "%s: Failed to add OPP %ld\n", 782 dev_warn(dev, "%s: Failed to add OPP %ld\n",
783 __func__, freq); 783 __func__, freq);
784 nr -= 2; 784 nr -= 2;
@@ -800,7 +800,7 @@ void of_free_opp_table(struct device *dev)
800 struct dev_pm_opp *opp, *tmp; 800 struct dev_pm_opp *opp, *tmp;
801 801
802 /* Check for existing list for 'dev' */ 802 /* Check for existing list for 'dev' */
803 dev_opp = find_device_opp(dev); 803 dev_opp = _find_device_opp(dev);
804 if (IS_ERR(dev_opp)) { 804 if (IS_ERR(dev_opp)) {
805 int error = PTR_ERR(dev_opp); 805 int error = PTR_ERR(dev_opp);
806 if (error != -ENODEV) 806 if (error != -ENODEV)
@@ -817,7 +817,7 @@ void of_free_opp_table(struct device *dev)
817 /* Free static OPPs */ 817 /* Free static OPPs */
818 list_for_each_entry_safe(opp, tmp, &dev_opp->opp_list, node) { 818 list_for_each_entry_safe(opp, tmp, &dev_opp->opp_list, node) {
819 if (!opp->dynamic) 819 if (!opp->dynamic)
820 __dev_pm_opp_remove(dev_opp, opp); 820 _opp_remove(dev_opp, opp);
821 } 821 }
822 822
823 mutex_unlock(&dev_opp_list_lock); 823 mutex_unlock(&dev_opp_list_lock);