aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/power/domain.c10
-rw-r--r--include/linux/pm_domain.h1
2 files changed, 2 insertions, 9 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index f9e7df554b2f..351df5bbd9c9 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1456,7 +1456,6 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
1456 gpd_data = gpd_data_new; 1456 gpd_data = gpd_data_new;
1457 dev->power.subsys_data->domain_data = &gpd_data->base; 1457 dev->power.subsys_data->domain_data = &gpd_data->base;
1458 } 1458 }
1459 gpd_data->refcount++;
1460 if (td) 1459 if (td)
1461 gpd_data->td = *td; 1460 gpd_data->td = *td;
1462 1461
@@ -1504,7 +1503,6 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
1504{ 1503{
1505 struct generic_pm_domain_data *gpd_data; 1504 struct generic_pm_domain_data *gpd_data;
1506 struct pm_domain_data *pdd; 1505 struct pm_domain_data *pdd;
1507 bool remove = false;
1508 int ret = 0; 1506 int ret = 0;
1509 1507
1510 dev_dbg(dev, "%s()\n", __func__); 1508 dev_dbg(dev, "%s()\n", __func__);
@@ -1533,10 +1531,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
1533 pdd = dev->power.subsys_data->domain_data; 1531 pdd = dev->power.subsys_data->domain_data;
1534 list_del_init(&pdd->list_node); 1532 list_del_init(&pdd->list_node);
1535 gpd_data = to_gpd_data(pdd); 1533 gpd_data = to_gpd_data(pdd);
1536 if (--gpd_data->refcount == 0) { 1534 dev->power.subsys_data->domain_data = NULL;
1537 dev->power.subsys_data->domain_data = NULL;
1538 remove = true;
1539 }
1540 1535
1541 spin_unlock_irq(&dev->power.lock); 1536 spin_unlock_irq(&dev->power.lock);
1542 1537
@@ -1547,8 +1542,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd,
1547 genpd_release_lock(genpd); 1542 genpd_release_lock(genpd);
1548 1543
1549 dev_pm_put_subsys_data(dev); 1544 dev_pm_put_subsys_data(dev);
1550 if (remove) 1545 genpd_free_dev_data(dev, gpd_data);
1551 genpd_free_dev_data(dev, gpd_data);
1552 1546
1553 return 0; 1547 return 0;
1554 1548
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index ed607760fc20..e160a0bba28d 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -114,7 +114,6 @@ struct generic_pm_domain_data {
114 struct gpd_timing_data td; 114 struct gpd_timing_data td;
115 struct notifier_block nb; 115 struct notifier_block nb;
116 struct mutex lock; 116 struct mutex lock;
117 unsigned int refcount;
118 int need_restore; 117 int need_restore;
119}; 118};
120 119