Message ID | 1414507090-516-3-git-send-email-ulf.hansson@linaro.org |
---|---|
State | New |
Headers | show |
Ulf Hansson <ulf.hansson@linaro.org> writes: > While adding devices to the generic PM domain we allocate data for the > struct generic_pm_domain_data. > > Don't allow existing generic_pm_domain_data in this case, since that > indicates the device is already being added from another context. Let's > instead return an error. > > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Similar to PATCH 1/4, it would be good to summarize/remind why this feature was added in the first place, and why it's not longer needed. Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7546242..9d511c7 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1423,9 +1423,9 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, spin_lock_irq(&dev->power.lock); - dev->pm_domain = &genpd->domain; if (dev->power.subsys_data->domain_data) { - gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); + ret = -EINVAL; + goto out; } else { gpd_data = gpd_data_new; dev->power.subsys_data->domain_data = &gpd_data->base; @@ -1433,6 +1433,8 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, if (td) gpd_data->td = *td; + dev->pm_domain = &genpd->domain; + spin_unlock_irq(&dev->power.lock); if (genpd->attach_dev)
While adding devices to the generic PM domain we allocate data for the struct generic_pm_domain_data. Don't allow existing generic_pm_domain_data in this case, since that indicates the device is already being added from another context. Let's instead return an error. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/base/power/domain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)