diff options
author | Jon Hunter <jonathanh@nvidia.com> | 2015-09-03 04:10:37 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-09-04 21:33:19 -0400 |
commit | 30e7a65b3fdb53cc49f85c965095e40aceea3961 (patch) | |
tree | c1c6bfaf9597591c7c987315b25bd5f6e429a202 | |
parent | 29e47e2173349ee06bd339f7753821c720d50923 (diff) |
PM / Domains: Ensure subdomain is not in use before removing
The function pm_genpd_remove_subdomain() removes a subdomain from a
generic PM domain, however, it does not check if the subdomain has any
slave domains or device attached before doing so. Therefore, add a test
to verify that the subdomain does not have any slave domains associated
or any device attached before removing.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/base/power/domain.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 62f757250235..16550c63d611 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -1473,6 +1473,13 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | |||
1473 | 1473 | ||
1474 | mutex_lock(&genpd->lock); | 1474 | mutex_lock(&genpd->lock); |
1475 | 1475 | ||
1476 | if (!list_empty(&subdomain->slave_links) || subdomain->device_count) { | ||
1477 | pr_warn("%s: unable to remove subdomain %s\n", genpd->name, | ||
1478 | subdomain->name); | ||
1479 | ret = -EBUSY; | ||
1480 | goto out; | ||
1481 | } | ||
1482 | |||
1476 | list_for_each_entry(link, &genpd->master_links, master_node) { | 1483 | list_for_each_entry(link, &genpd->master_links, master_node) { |
1477 | if (link->slave != subdomain) | 1484 | if (link->slave != subdomain) |
1478 | continue; | 1485 | continue; |
@@ -1491,6 +1498,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | |||
1491 | break; | 1498 | break; |
1492 | } | 1499 | } |
1493 | 1500 | ||
1501 | out: | ||
1494 | mutex_unlock(&genpd->lock); | 1502 | mutex_unlock(&genpd->lock); |
1495 | 1503 | ||
1496 | return ret; | 1504 | return ret; |