diff options
author | Rafael J. Wysocki | 2014-10-07 01:18:58 +0200 |
---|---|---|
committer | Rafael J. Wysocki | 2014-10-07 01:18:58 +0200 |
commit | 9f1a053296953c69d7f23511db9441290cb89e2c (patch) | |
tree | 97c6104d5d620736cc723788d3652c63f8e6b7b8 /drivers/base | |
parent | c9671d17f82accff42bfafdd776edc260f8d1bb3 (diff) | |
parent | a968bed78b549b4c61d4a46e59161fc1f60f96a6 (diff) |
Merge branch 'pm-clk'
* pm-clk:
PM / clk: Fix crash in clocks management code if !CONFIG_PM_RUNTIME
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/clock_ops.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index b99e6c06ee67..78369305e069 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -368,8 +368,13 @@ int pm_clk_suspend(struct device *dev) spin_lock_irqsave(&psd->lock, flags); - list_for_each_entry_reverse(ce, &psd->clock_list, node) - clk_disable(ce->clk); + list_for_each_entry_reverse(ce, &psd->clock_list, node) { + if (ce->status < PCE_STATUS_ERROR) { + if (ce->status == PCE_STATUS_ENABLED) + clk_disable(ce->clk); + ce->status = PCE_STATUS_ACQUIRED; + } + } spin_unlock_irqrestore(&psd->lock, flags); @@ -385,6 +390,7 @@ int pm_clk_resume(struct device *dev) struct pm_subsys_data *psd = dev_to_psd(dev); struct pm_clock_entry *ce; unsigned long flags; + int ret; dev_dbg(dev, "%s()\n", __func__); @@ -394,8 +400,13 @@ int pm_clk_resume(struct device *dev) spin_lock_irqsave(&psd->lock, flags); - list_for_each_entry(ce, &psd->clock_list, node) - __pm_clk_enable(dev, ce->clk); + list_for_each_entry(ce, &psd->clock_list, node) { + if (ce->status < PCE_STATUS_ERROR) { + ret = __pm_clk_enable(dev, ce->clk); + if (!ret) + ce->status = PCE_STATUS_ENABLED; + } + } spin_unlock_irqrestore(&psd->lock, flags); |