summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2018-04-26 11:53:03 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-14 23:58:44 +0300
commit4f688748c958deb947759773be6dffe6b44d084d (patch)
treef403d602c8e114a33618ba35d36b1ceb22a0de01 /drivers/base
parentb56d9c9135629632faff44cff153784e76b82550 (diff)
downloadlinux-4f688748c958deb947759773be6dffe6b44d084d.tar.xz
PM / Domains: Check for existing PM domain in dev_pm_domain_attach()
Instead of checking if an existing PM domain pointer has been assigned in genpd_dev_pm_attach() and acpi_dev_pm_attach(), move the check to the common path in dev_pm_domain_attach(), thus potentially avoid one unnecessary check. 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/common.c3
-rw-r--r--drivers/base/power/domain.c3
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c
index f6a9ad52cbbf..f3cf61f58f25 100644
--- a/drivers/base/power/common.c
+++ b/drivers/base/power/common.c
@@ -104,6 +104,9 @@ int dev_pm_domain_attach(struct device *dev, bool power_on)
{
int ret;
+ if (dev->pm_domain)
+ return -EEXIST;
+
ret = acpi_dev_pm_attach(dev, power_on);
if (ret)
ret = genpd_dev_pm_attach(dev);
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index d4b96edb027d..b816adbe1e62 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2194,9 +2194,6 @@ int genpd_dev_pm_attach(struct device *dev)
if (!dev->of_node)
return -ENODEV;
- if (dev->pm_domain)
- return -EEXIST;
-
ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
"#power-domain-cells", 0, &pd_args);
if (ret < 0)