diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2019-10-16 17:16:49 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-11-13 13:44:15 +0300 |
commit | fe0c2baae0bd47958991f13fb7551bf1328b4ea7 (patch) | |
tree | 378f37ad97569b360a411858b410fe95e894ae5b /drivers/base | |
parent | 1b32999e205bb5804400aaa61441ecb356381402 (diff) | |
download | linux-fe0c2baae0bd47958991f13fb7551bf1328b4ea7.tar.xz |
PM / Domains: Convert to dev_to_genpd_safe() in genpd_syscore_switch()
The intent with walking the gpd_list via calling genpd_present() from
genpd_syscore_switch(), is to make sure the dev->pm_domain pointer belongs
to a registered genpd. However, as a genpd can't be removed if there is a
device attached to it, let's convert to use the quicker dev_to_genpd_safe()
instead.
Due to the above change, this allows us to clean up genpd_present() and
move it inside CONFIG_PM_GENERIC_DOMAINS_OF, so let's do that as well.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/domain.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 2adf0661fa3e..8e5725b11ee8 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -929,24 +929,6 @@ static int __init genpd_power_off_unused(void) } late_initcall(genpd_power_off_unused); -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_GENERIC_DOMAINS_OF) - -static bool genpd_present(const struct generic_pm_domain *genpd) -{ - const struct generic_pm_domain *gpd; - - if (IS_ERR_OR_NULL(genpd)) - return false; - - list_for_each_entry(gpd, &gpd_list, gpd_list_node) - if (gpd == genpd) - return true; - - return false; -} - -#endif - #ifdef CONFIG_PM_SLEEP /** @@ -1361,8 +1343,8 @@ static void genpd_syscore_switch(struct device *dev, bool suspend) { struct generic_pm_domain *genpd; - genpd = dev_to_genpd(dev); - if (!genpd_present(genpd)) + genpd = dev_to_genpd_safe(dev); + if (!genpd) return; if (suspend) { @@ -2028,6 +2010,16 @@ static int genpd_add_provider(struct device_node *np, genpd_xlate_t xlate, return 0; } +static bool genpd_present(const struct generic_pm_domain *genpd) +{ + const struct generic_pm_domain *gpd; + + list_for_each_entry(gpd, &gpd_list, gpd_list_node) + if (gpd == genpd) + return true; + return false; +} + /** * of_genpd_add_provider_simple() - Register a simple PM domain provider * @np: Device node pointer associated with the PM domain provider. |