Commit f6f18a26 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-domains'

* pm-domains:
  PM / Domains: Allocate memory outside domain locks
  PM / Domains: Remove dev->driver check for runtime PM
parents 1f47b0dd 2547923d
...@@ -321,8 +321,7 @@ static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async) ...@@ -321,8 +321,7 @@ static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async)
if (stat > PM_QOS_FLAGS_NONE) if (stat > PM_QOS_FLAGS_NONE)
return -EBUSY; return -EBUSY;
if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev) if (!pm_runtime_suspended(pdd->dev) || pdd->dev->power.irq_safe)
|| pdd->dev->power.irq_safe))
not_suspended++; not_suspended++;
} }
...@@ -1312,13 +1311,17 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, ...@@ -1312,13 +1311,17 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
struct generic_pm_domain *subdomain) struct generic_pm_domain *subdomain)
{ {
struct gpd_link *link; struct gpd_link *link, *itr;
int ret = 0; int ret = 0;
if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain) if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)
|| genpd == subdomain) || genpd == subdomain)
return -EINVAL; return -EINVAL;
link = kzalloc(sizeof(*link), GFP_KERNEL);
if (!link)
return -ENOMEM;
mutex_lock(&genpd->lock); mutex_lock(&genpd->lock);
mutex_lock_nested(&subdomain->lock, SINGLE_DEPTH_NESTING); mutex_lock_nested(&subdomain->lock, SINGLE_DEPTH_NESTING);
...@@ -1328,18 +1331,13 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, ...@@ -1328,18 +1331,13 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
goto out; goto out;
} }
list_for_each_entry(link, &genpd->master_links, master_node) { list_for_each_entry(itr, &genpd->master_links, master_node) {
if (link->slave == subdomain && link->master == genpd) { if (itr->slave == subdomain && itr->master == genpd) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
} }
link = kzalloc(sizeof(*link), GFP_KERNEL);
if (!link) {
ret = -ENOMEM;
goto out;
}
link->master = genpd; link->master = genpd;
list_add_tail(&link->master_node, &genpd->master_links); list_add_tail(&link->master_node, &genpd->master_links);
link->slave = subdomain; link->slave = subdomain;
...@@ -1350,7 +1348,8 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, ...@@ -1350,7 +1348,8 @@ int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
out: out:
mutex_unlock(&subdomain->lock); mutex_unlock(&subdomain->lock);
mutex_unlock(&genpd->lock); mutex_unlock(&genpd->lock);
if (ret)
kfree(link);
return ret; return ret;
} }
......
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