diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2016-12-08 08:45:20 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-26 19:30:31 -0500 |
commit | 86e12eac1f7f84b03512ecfa110c48b9204e6286 (patch) | |
tree | b832a69097f6f2902b081f42ae5e06f2b768d633 | |
parent | 7a308bb3016f57e5be11a677d15b821536419d36 (diff) |
PM / Domains: Rename functions in genpd for power on/off
Currently the mix of genpd_poweron(), genpd_power_on(),
genpd_sync_poweron() and the ->power_on() callback, makes
a bit difficult to follow the path of execution. The similar
applies to the functions dealing with power off.
In a way to improve this understanding, let's do the following renaming:
genpd_power_on() -> _genpd_power_on()
genpd_poweron() -> genpd_power_on()
genpd_sync_poweron() -> genpd_sync_power_on()
genpd_power_off() -> _genpd_power_off()
genpd_poweroff() -> genpd_power_off()
genpd_sync_poweroff() -> genpd_sync_power_off()
genpd_poweroff_unused() -> genpd_power_off_unused()
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/power/domain.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 2997026b4dfb..fd2e3e1eac65 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -201,7 +201,7 @@ static void genpd_sd_counter_inc(struct generic_pm_domain *genpd) | |||
201 | smp_mb__after_atomic(); | 201 | smp_mb__after_atomic(); |
202 | } | 202 | } |
203 | 203 | ||
204 | static int genpd_power_on(struct generic_pm_domain *genpd, bool timed) | 204 | static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed) |
205 | { | 205 | { |
206 | unsigned int state_idx = genpd->state_idx; | 206 | unsigned int state_idx = genpd->state_idx; |
207 | ktime_t time_start; | 207 | ktime_t time_start; |
@@ -231,7 +231,7 @@ static int genpd_power_on(struct generic_pm_domain *genpd, bool timed) | |||
231 | return ret; | 231 | return ret; |
232 | } | 232 | } |
233 | 233 | ||
234 | static int genpd_power_off(struct generic_pm_domain *genpd, bool timed) | 234 | static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed) |
235 | { | 235 | { |
236 | unsigned int state_idx = genpd->state_idx; | 236 | unsigned int state_idx = genpd->state_idx; |
237 | ktime_t time_start; | 237 | ktime_t time_start; |
@@ -262,10 +262,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool timed) | |||
262 | } | 262 | } |
263 | 263 | ||
264 | /** | 264 | /** |
265 | * genpd_queue_power_off_work - Queue up the execution of genpd_poweroff(). | 265 | * genpd_queue_power_off_work - Queue up the execution of genpd_power_off(). |
266 | * @genpd: PM domain to power off. | 266 | * @genpd: PM domain to power off. |
267 | * | 267 | * |
268 | * Queue up the execution of genpd_poweroff() unless it's already been done | 268 | * Queue up the execution of genpd_power_off() unless it's already been done |
269 | * before. | 269 | * before. |
270 | */ | 270 | */ |
271 | static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) | 271 | static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) |
@@ -274,14 +274,14 @@ static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) | |||
274 | } | 274 | } |
275 | 275 | ||
276 | /** | 276 | /** |
277 | * genpd_poweron - Restore power to a given PM domain and its masters. | 277 | * genpd_power_on - Restore power to a given PM domain and its masters. |
278 | * @genpd: PM domain to power up. | 278 | * @genpd: PM domain to power up. |
279 | * @depth: nesting count for lockdep. | 279 | * @depth: nesting count for lockdep. |
280 | * | 280 | * |
281 | * Restore power to @genpd and all of its masters so that it is possible to | 281 | * Restore power to @genpd and all of its masters so that it is possible to |
282 | * resume a device belonging to it. | 282 | * resume a device belonging to it. |
283 | */ | 283 | */ |
284 | static int genpd_poweron(struct generic_pm_domain *genpd, unsigned int depth) | 284 | static int genpd_power_on(struct generic_pm_domain *genpd, unsigned int depth) |
285 | { | 285 | { |
286 | struct gpd_link *link; | 286 | struct gpd_link *link; |
287 | int ret = 0; | 287 | int ret = 0; |
@@ -300,7 +300,7 @@ static int genpd_poweron(struct generic_pm_domain *genpd, unsigned int depth) | |||
300 | genpd_sd_counter_inc(master); | 300 | genpd_sd_counter_inc(master); |
301 | 301 | ||
302 | genpd_lock_nested(master, depth + 1); | 302 | genpd_lock_nested(master, depth + 1); |
303 | ret = genpd_poweron(master, depth + 1); | 303 | ret = genpd_power_on(master, depth + 1); |
304 | genpd_unlock(master); | 304 | genpd_unlock(master); |
305 | 305 | ||
306 | if (ret) { | 306 | if (ret) { |
@@ -309,7 +309,7 @@ static int genpd_poweron(struct generic_pm_domain *genpd, unsigned int depth) | |||
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | ret = genpd_power_on(genpd, true); | 312 | ret = _genpd_power_on(genpd, true); |
313 | if (ret) | 313 | if (ret) |
314 | goto err; | 314 | goto err; |
315 | 315 | ||
@@ -368,14 +368,14 @@ static int genpd_dev_pm_qos_notifier(struct notifier_block *nb, | |||
368 | } | 368 | } |
369 | 369 | ||
370 | /** | 370 | /** |
371 | * genpd_poweroff - Remove power from a given PM domain. | 371 | * genpd_power_off - Remove power from a given PM domain. |
372 | * @genpd: PM domain to power down. | 372 | * @genpd: PM domain to power down. |
373 | * @is_async: PM domain is powered down from a scheduled work | 373 | * @is_async: PM domain is powered down from a scheduled work |
374 | * | 374 | * |
375 | * If all of the @genpd's devices have been suspended and all of its subdomains | 375 | * If all of the @genpd's devices have been suspended and all of its subdomains |
376 | * have been powered down, remove power from @genpd. | 376 | * have been powered down, remove power from @genpd. |
377 | */ | 377 | */ |
378 | static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async) | 378 | static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) |
379 | { | 379 | { |
380 | struct pm_domain_data *pdd; | 380 | struct pm_domain_data *pdd; |
381 | struct gpd_link *link; | 381 | struct gpd_link *link; |
@@ -427,13 +427,13 @@ static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async) | |||
427 | 427 | ||
428 | /* | 428 | /* |
429 | * If sd_count > 0 at this point, one of the subdomains hasn't | 429 | * If sd_count > 0 at this point, one of the subdomains hasn't |
430 | * managed to call genpd_poweron() for the master yet after | 430 | * managed to call genpd_power_on() for the master yet after |
431 | * incrementing it. In that case genpd_poweron() will wait | 431 | * incrementing it. In that case genpd_power_on() will wait |
432 | * for us to drop the lock, so we can call .power_off() and let | 432 | * for us to drop the lock, so we can call .power_off() and let |
433 | * the genpd_poweron() restore power for us (this shouldn't | 433 | * the genpd_power_on() restore power for us (this shouldn't |
434 | * happen very often). | 434 | * happen very often). |
435 | */ | 435 | */ |
436 | ret = genpd_power_off(genpd, true); | 436 | ret = _genpd_power_off(genpd, true); |
437 | if (ret) | 437 | if (ret) |
438 | return ret; | 438 | return ret; |
439 | } | 439 | } |
@@ -459,7 +459,7 @@ static void genpd_power_off_work_fn(struct work_struct *work) | |||
459 | genpd = container_of(work, struct generic_pm_domain, power_off_work); | 459 | genpd = container_of(work, struct generic_pm_domain, power_off_work); |
460 | 460 | ||
461 | genpd_lock(genpd); | 461 | genpd_lock(genpd); |
462 | genpd_poweroff(genpd, true); | 462 | genpd_power_off(genpd, true); |
463 | genpd_unlock(genpd); | 463 | genpd_unlock(genpd); |
464 | } | 464 | } |
465 | 465 | ||
@@ -578,7 +578,7 @@ static int genpd_runtime_suspend(struct device *dev) | |||
578 | return 0; | 578 | return 0; |
579 | 579 | ||
580 | genpd_lock(genpd); | 580 | genpd_lock(genpd); |
581 | genpd_poweroff(genpd, false); | 581 | genpd_power_off(genpd, false); |
582 | genpd_unlock(genpd); | 582 | genpd_unlock(genpd); |
583 | 583 | ||
584 | return 0; | 584 | return 0; |
@@ -618,7 +618,7 @@ static int genpd_runtime_resume(struct device *dev) | |||
618 | } | 618 | } |
619 | 619 | ||
620 | genpd_lock(genpd); | 620 | genpd_lock(genpd); |
621 | ret = genpd_poweron(genpd, 0); | 621 | ret = genpd_power_on(genpd, 0); |
622 | genpd_unlock(genpd); | 622 | genpd_unlock(genpd); |
623 | 623 | ||
624 | if (ret) | 624 | if (ret) |
@@ -658,7 +658,7 @@ err_poweroff: | |||
658 | if (!pm_runtime_is_irq_safe(dev) || | 658 | if (!pm_runtime_is_irq_safe(dev) || |
659 | (pm_runtime_is_irq_safe(dev) && genpd_is_irq_safe(genpd))) { | 659 | (pm_runtime_is_irq_safe(dev) && genpd_is_irq_safe(genpd))) { |
660 | genpd_lock(genpd); | 660 | genpd_lock(genpd); |
661 | genpd_poweroff(genpd, 0); | 661 | genpd_power_off(genpd, 0); |
662 | genpd_unlock(genpd); | 662 | genpd_unlock(genpd); |
663 | } | 663 | } |
664 | 664 | ||
@@ -674,9 +674,9 @@ static int __init pd_ignore_unused_setup(char *__unused) | |||
674 | __setup("pd_ignore_unused", pd_ignore_unused_setup); | 674 | __setup("pd_ignore_unused", pd_ignore_unused_setup); |
675 | 675 | ||
676 | /** | 676 | /** |
677 | * genpd_poweroff_unused - Power off all PM domains with no devices in use. | 677 | * genpd_power_off_unused - Power off all PM domains with no devices in use. |
678 | */ | 678 | */ |
679 | static int __init genpd_poweroff_unused(void) | 679 | static int __init genpd_power_off_unused(void) |
680 | { | 680 | { |
681 | struct generic_pm_domain *genpd; | 681 | struct generic_pm_domain *genpd; |
682 | 682 | ||
@@ -694,7 +694,7 @@ static int __init genpd_poweroff_unused(void) | |||
694 | 694 | ||
695 | return 0; | 695 | return 0; |
696 | } | 696 | } |
697 | late_initcall(genpd_poweroff_unused); | 697 | late_initcall(genpd_power_off_unused); |
698 | 698 | ||
699 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_GENERIC_DOMAINS_OF) | 699 | #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_GENERIC_DOMAINS_OF) |
700 | 700 | ||
@@ -727,7 +727,7 @@ static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd, | |||
727 | } | 727 | } |
728 | 728 | ||
729 | /** | 729 | /** |
730 | * genpd_sync_poweroff - Synchronously power off a PM domain and its masters. | 730 | * genpd_sync_power_off - Synchronously power off a PM domain and its masters. |
731 | * @genpd: PM domain to power off, if possible. | 731 | * @genpd: PM domain to power off, if possible. |
732 | * | 732 | * |
733 | * Check if the given PM domain can be powered off (during system suspend or | 733 | * Check if the given PM domain can be powered off (during system suspend or |
@@ -738,7 +738,7 @@ static bool genpd_dev_active_wakeup(struct generic_pm_domain *genpd, | |||
738 | * executed sequentially, so it is guaranteed that it will never run twice in | 738 | * executed sequentially, so it is guaranteed that it will never run twice in |
739 | * parallel). | 739 | * parallel). |
740 | */ | 740 | */ |
741 | static void genpd_sync_poweroff(struct generic_pm_domain *genpd) | 741 | static void genpd_sync_power_off(struct generic_pm_domain *genpd) |
742 | { | 742 | { |
743 | struct gpd_link *link; | 743 | struct gpd_link *link; |
744 | 744 | ||
@@ -751,18 +751,18 @@ static void genpd_sync_poweroff(struct generic_pm_domain *genpd) | |||
751 | 751 | ||
752 | /* Choose the deepest state when suspending */ | 752 | /* Choose the deepest state when suspending */ |
753 | genpd->state_idx = genpd->state_count - 1; | 753 | genpd->state_idx = genpd->state_count - 1; |
754 | genpd_power_off(genpd, false); | 754 | _genpd_power_off(genpd, false); |
755 | 755 | ||
756 | genpd->status = GPD_STATE_POWER_OFF; | 756 | genpd->status = GPD_STATE_POWER_OFF; |
757 | 757 | ||
758 | list_for_each_entry(link, &genpd->slave_links, slave_node) { | 758 | list_for_each_entry(link, &genpd->slave_links, slave_node) { |
759 | genpd_sd_counter_dec(link->master); | 759 | genpd_sd_counter_dec(link->master); |
760 | genpd_sync_poweroff(link->master); | 760 | genpd_sync_power_off(link->master); |
761 | } | 761 | } |
762 | } | 762 | } |
763 | 763 | ||
764 | /** | 764 | /** |
765 | * genpd_sync_poweron - Synchronously power on a PM domain and its masters. | 765 | * genpd_sync_power_on - Synchronously power on a PM domain and its masters. |
766 | * @genpd: PM domain to power on. | 766 | * @genpd: PM domain to power on. |
767 | * | 767 | * |
768 | * This function is only called in "noirq" and "syscore" stages of system power | 768 | * This function is only called in "noirq" and "syscore" stages of system power |
@@ -770,7 +770,7 @@ static void genpd_sync_poweroff(struct generic_pm_domain *genpd) | |||
770 | * executed sequentially, so it is guaranteed that it will never run twice in | 770 | * executed sequentially, so it is guaranteed that it will never run twice in |
771 | * parallel). | 771 | * parallel). |
772 | */ | 772 | */ |
773 | static void genpd_sync_poweron(struct generic_pm_domain *genpd) | 773 | static void genpd_sync_power_on(struct generic_pm_domain *genpd) |
774 | { | 774 | { |
775 | struct gpd_link *link; | 775 | struct gpd_link *link; |
776 | 776 | ||
@@ -778,11 +778,11 @@ static void genpd_sync_poweron(struct generic_pm_domain *genpd) | |||
778 | return; | 778 | return; |
779 | 779 | ||
780 | list_for_each_entry(link, &genpd->slave_links, slave_node) { | 780 | list_for_each_entry(link, &genpd->slave_links, slave_node) { |
781 | genpd_sync_poweron(link->master); | 781 | genpd_sync_power_on(link->master); |
782 | genpd_sd_counter_inc(link->master); | 782 | genpd_sd_counter_inc(link->master); |
783 | } | 783 | } |
784 | 784 | ||
785 | genpd_power_on(genpd, false); | 785 | _genpd_power_on(genpd, false); |
786 | 786 | ||
787 | genpd->status = GPD_STATE_ACTIVE; | 787 | genpd->status = GPD_STATE_ACTIVE; |
788 | } | 788 | } |
@@ -894,7 +894,7 @@ static int pm_genpd_suspend_noirq(struct device *dev) | |||
894 | * the same PM domain, so it is not necessary to use locking here. | 894 | * the same PM domain, so it is not necessary to use locking here. |
895 | */ | 895 | */ |
896 | genpd->suspended_count++; | 896 | genpd->suspended_count++; |
897 | genpd_sync_poweroff(genpd); | 897 | genpd_sync_power_off(genpd); |
898 | 898 | ||
899 | return 0; | 899 | return 0; |
900 | } | 900 | } |
@@ -924,7 +924,7 @@ static int pm_genpd_resume_noirq(struct device *dev) | |||
924 | * guaranteed that this function will never run twice in parallel for | 924 | * guaranteed that this function will never run twice in parallel for |
925 | * the same PM domain, so it is not necessary to use locking here. | 925 | * the same PM domain, so it is not necessary to use locking here. |
926 | */ | 926 | */ |
927 | genpd_sync_poweron(genpd); | 927 | genpd_sync_power_on(genpd); |
928 | genpd->suspended_count--; | 928 | genpd->suspended_count--; |
929 | 929 | ||
930 | if (genpd->dev_ops.stop && genpd->dev_ops.start) | 930 | if (genpd->dev_ops.stop && genpd->dev_ops.start) |
@@ -1012,12 +1012,12 @@ static int pm_genpd_restore_noirq(struct device *dev) | |||
1012 | if (genpd->suspended_count++ == 0) | 1012 | if (genpd->suspended_count++ == 0) |
1013 | /* | 1013 | /* |
1014 | * The boot kernel might put the domain into arbitrary state, | 1014 | * The boot kernel might put the domain into arbitrary state, |
1015 | * so make it appear as powered off to genpd_sync_poweron(), | 1015 | * so make it appear as powered off to genpd_sync_power_on(), |
1016 | * so that it tries to power it on in case it was really off. | 1016 | * so that it tries to power it on in case it was really off. |
1017 | */ | 1017 | */ |
1018 | genpd->status = GPD_STATE_POWER_OFF; | 1018 | genpd->status = GPD_STATE_POWER_OFF; |
1019 | 1019 | ||
1020 | genpd_sync_poweron(genpd); | 1020 | genpd_sync_power_on(genpd); |
1021 | 1021 | ||
1022 | if (genpd->dev_ops.stop && genpd->dev_ops.start) | 1022 | if (genpd->dev_ops.stop && genpd->dev_ops.start) |
1023 | ret = pm_runtime_force_resume(dev); | 1023 | ret = pm_runtime_force_resume(dev); |
@@ -1072,9 +1072,9 @@ static void genpd_syscore_switch(struct device *dev, bool suspend) | |||
1072 | 1072 | ||
1073 | if (suspend) { | 1073 | if (suspend) { |
1074 | genpd->suspended_count++; | 1074 | genpd->suspended_count++; |
1075 | genpd_sync_poweroff(genpd); | 1075 | genpd_sync_power_off(genpd); |
1076 | } else { | 1076 | } else { |
1077 | genpd_sync_poweron(genpd); | 1077 | genpd_sync_power_on(genpd); |
1078 | genpd->suspended_count--; | 1078 | genpd->suspended_count--; |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
@@ -2043,7 +2043,7 @@ int genpd_dev_pm_attach(struct device *dev) | |||
2043 | dev->pm_domain->sync = genpd_dev_pm_sync; | 2043 | dev->pm_domain->sync = genpd_dev_pm_sync; |
2044 | 2044 | ||
2045 | genpd_lock(pd); | 2045 | genpd_lock(pd); |
2046 | ret = genpd_poweron(pd, 0); | 2046 | ret = genpd_power_on(pd, 0); |
2047 | genpd_unlock(pd); | 2047 | genpd_unlock(pd); |
2048 | out: | 2048 | out: |
2049 | return ret ? -EPROBE_DEFER : 0; | 2049 | return ret ? -EPROBE_DEFER : 0; |