Commit 4f688748 authored by Ulf Hansson's avatar Ulf Hansson Committed by Rafael J. Wysocki

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: default avatarUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent b56d9c91
......@@ -1259,9 +1259,6 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on)
if (!adev)
return -ENODEV;
if (dev->pm_domain)
return -EEXIST;
/*
* Only attach the power domain to the first device if the
* companion is shared by multiple. This is to prevent doing power
......
......@@ -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);
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment