summaryrefslogtreecommitdiff
path: root/drivers/base/power/clock_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/clock_ops.c')
-rw-r--r--drivers/base/power/clock_ops.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index b7f1db4f5945..8383e2488d79 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -140,12 +140,8 @@ void pm_clk_remove(struct device *dev, const char *con_id)
void pm_clk_init(struct device *dev)
{
struct pm_subsys_data *psd = dev_to_psd(dev);
-
- if (!psd)
- return;
-
- INIT_LIST_HEAD(&psd->clock_list);
- spin_lock_init(&psd->lock);
+ if (psd)
+ INIT_LIST_HEAD(&psd->clock_list);
}
/**
@@ -157,16 +153,8 @@ void pm_clk_init(struct device *dev)
*/
int pm_clk_create(struct device *dev)
{
- struct pm_subsys_data *psd;
-
- psd = kzalloc(sizeof(*psd), GFP_KERNEL);
- if (!psd) {
- dev_err(dev, "Not enough memory for PM clock data.\n");
- return -ENOMEM;
- }
- dev->power.subsys_data = psd;
- pm_clk_init(dev);
- return 0;
+ int ret = dev_pm_get_subsys_data(dev);
+ return ret < 0 ? ret : 0;
}
/**
@@ -185,8 +173,6 @@ void pm_clk_destroy(struct device *dev)
if (!psd)
return;
- dev->power.subsys_data = NULL;
-
spin_lock_irq(&psd->lock);
list_for_each_entry_safe_reverse(ce, c, &psd->clock_list, node)
@@ -194,7 +180,7 @@ void pm_clk_destroy(struct device *dev)
spin_unlock_irq(&psd->lock);
- kfree(psd);
+ dev_pm_put_subsys_data(dev);
}
#endif /* CONFIG_PM */