All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] PM / Domains: Ensure subdomain is not in use before removing
@ 2015-08-27  9:21 Jon Hunter
  2015-08-27 11:37 ` Geert Uytterhoeven
  2015-08-28 17:38 ` Kevin Hilman
  0 siblings, 2 replies; 5+ messages in thread
From: Jon Hunter @ 2015-08-27  9:21 UTC (permalink / raw)
  To: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson; +Cc: geert, linux-pm, Jon Hunter

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>
---
 drivers/base/power/domain.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 27888a90ca98..a3ed71d8129a 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1469,6 +1469,11 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
 
 	mutex_lock(&genpd->lock);
 
+	if (!list_empty(&subdomain->slave_links) || subdomain->device_count) {
+		ret = -EBUSY;
+		goto out;
+	}
+
 	list_for_each_entry(link, &genpd->master_links, master_node) {
 		if (link->slave != subdomain)
 			continue;
@@ -1487,6 +1492,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
 		break;
 	}
 
+out:
 	mutex_unlock(&genpd->lock);
 
 	return ret;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-03  8:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27  9:21 [RFC PATCH] PM / Domains: Ensure subdomain is not in use before removing Jon Hunter
2015-08-27 11:37 ` Geert Uytterhoeven
2015-08-27 11:47   ` Jon Hunter
2015-08-28 17:38 ` Kevin Hilman
2015-09-03  8:08   ` Jon Hunter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.