All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / Clocks: Only disable enabled clocks in pm_clk_suspend()
@ 2011-11-09 11:13 Magnus Damm
  2011-11-09 23:57 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2011-11-09 11:13 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@opensource.se>

Refrain from running clk_disable() on clocks that
have not been enabled. A typical case when this can
happen is during Suspend-to-RAM for devices that have
no driver associated with them. In such case the clock
may be in default ACQUIRED state.

Without this patch the sh7372 Mackerel board crashes
in __clk_disable() during Suspend-to-RAM with:
"Trying to disable clock 0xdeadbeef with 0 usecount"
This happens for the CEU device which is added during
boot. The test case has no CEU driver included in the
kernel configuration. Needed for v3.2-rc1.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 drivers/base/power/clock_ops.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- 0001/drivers/base/power/clock_ops.c
+++ work/drivers/base/power/clock_ops.c	2011-11-09 19:28:03.000000000 +0900
@@ -229,7 +229,8 @@ int pm_clk_suspend(struct device *dev)
 
 	list_for_each_entry_reverse(ce, &psd->clock_list, node) {
 		if (ce->status < PCE_STATUS_ERROR) {
-			clk_disable(ce->clk);
+			if (ce->status = PCE_STATUS_ENABLED)
+				clk_disable(ce->clk);
 			ce->status = PCE_STATUS_ACQUIRED;
 		}
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-09 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 11:13 [PATCH] PM / Clocks: Only disable enabled clocks in pm_clk_suspend() Magnus Damm
2011-11-09 23:57 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.