diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2016-01-07 16:46:13 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-01-08 01:12:06 +0100 |
commit | 989561de9b5112999475b406557d9c7e9e59c041 (patch) | |
tree | 1c4257ef719116fecbea9ecdd14febb6af2c336b /drivers/base/power/domain.c | |
parent | 6b9cb42752dafba3761dde0002ca58ca518b6311 (diff) | |
download | op-kernel-dev-989561de9b5112999475b406557d9c7e9e59c041.zip op-kernel-dev-989561de9b5112999475b406557d9c7e9e59c041.tar.gz |
PM / Domains: add setter for dev.pm_domain
Adds a function that sets the pointer to dev_pm_domain in struct device
and that warns if the device has already finished probing. The reason
why we want to enforce that is because in the general case that can
cause problems and also that we can simplify code quite a bit if we can
always assume that.
This patch also changes all current code that directly sets the
dev.pm_domain pointer.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power/domain.c')
-rw-r--r-- | drivers/base/power/domain.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 167418e..abbac6f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1177,10 +1177,11 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev, } dev->power.subsys_data->domain_data = &gpd_data->base; - dev->pm_domain = &genpd->domain; spin_unlock_irq(&dev->power.lock); + dev_pm_domain_set(dev, &genpd->domain); + return gpd_data; err_free: @@ -1194,9 +1195,10 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev, static void genpd_free_dev_data(struct device *dev, struct generic_pm_domain_data *gpd_data) { + dev_pm_domain_set(dev, NULL); + spin_lock_irq(&dev->power.lock); - dev->pm_domain = NULL; dev->power.subsys_data->domain_data = NULL; spin_unlock_irq(&dev->power.lock); |