Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'pm-clk'

* pm-clk:
PM / clock_ops: report clock errors from clk_enable()
PM / clock_ops: check return of clk_enable() in pm_clk_resume()
PM / clock_ops: fix up clk prepare/unprepare count

+25 -5
+25 -5
drivers/base/power/clock_ops.c
··· 33 33 }; 34 34 35 35 /** 36 + * pm_clk_enable - Enable a clock, reporting any errors 37 + * @dev: The device for the given clock 38 + * @clk: The clock being enabled. 39 + */ 40 + static inline int __pm_clk_enable(struct device *dev, struct clk *clk) 41 + { 42 + int ret = clk_enable(clk); 43 + if (ret) 44 + dev_err(dev, "%s: failed to enable clk %p, error %d\n", 45 + __func__, clk, ret); 46 + 47 + return ret; 48 + } 49 + 50 + /** 36 51 * pm_clk_acquire - Acquire a device clock. 37 52 * @dev: Device whose clock is to be acquired. 38 53 * @ce: PM clock entry corresponding to the clock. ··· 58 43 if (IS_ERR(ce->clk)) { 59 44 ce->status = PCE_STATUS_ERROR; 60 45 } else { 46 + clk_prepare(ce->clk); 61 47 ce->status = PCE_STATUS_ACQUIRED; 62 48 dev_dbg(dev, "Clock %s managed by runtime PM.\n", ce->con_id); 63 49 } ··· 115 99 116 100 if (ce->status < PCE_STATUS_ERROR) { 117 101 if (ce->status == PCE_STATUS_ENABLED) 118 - clk_disable_unprepare(ce->clk); 102 + clk_disable(ce->clk); 119 103 120 - if (ce->status >= PCE_STATUS_ACQUIRED) 104 + if (ce->status >= PCE_STATUS_ACQUIRED) { 105 + clk_unprepare(ce->clk); 121 106 clk_put(ce->clk); 107 + } 122 108 } 123 109 124 110 kfree(ce->con_id); ··· 267 249 struct pm_subsys_data *psd = dev_to_psd(dev); 268 250 struct pm_clock_entry *ce; 269 251 unsigned long flags; 252 + int ret; 270 253 271 254 dev_dbg(dev, "%s()\n", __func__); 272 255 ··· 278 259 279 260 list_for_each_entry(ce, &psd->clock_list, node) { 280 261 if (ce->status < PCE_STATUS_ERROR) { 281 - clk_enable(ce->clk); 282 - ce->status = PCE_STATUS_ENABLED; 262 + ret = __pm_clk_enable(dev, ce->clk); 263 + if (!ret) 264 + ce->status = PCE_STATUS_ENABLED; 283 265 } 284 266 } 285 267 ··· 396 376 spin_lock_irqsave(&psd->lock, flags); 397 377 398 378 list_for_each_entry(ce, &psd->clock_list, node) 399 - clk_enable(ce->clk); 379 + __pm_clk_enable(dev, ce->clk); 400 380 401 381 spin_unlock_irqrestore(&psd->lock, flags); 402 382