Commit d4905ce38c73964b868037e49a5945e1cf47a7f2

Authored by Paul Mundt
1 parent db7eba292e

Revert "clocksource: sh_tmu: Runtime PM support"

This reverts commit 1b842e91fea9447eff5eb687e28ad61c02f5033e.

There is a fundamental ordering race between the early and late probe
paths and the runtime PM tie-in that results in __pm_runtime_resume()
attempting to take a lock that hasn't been initialized yet (which by
proxy also suggests that pm_runtime_init() hasn't yet been run on the
device either, making the entire thing unsafe) -- resulting in instant
death on SMP or on UP with spinlock debugging enabled:

	 sh_tmu.0: used for clock events
	 sh_tmu.0: used for periodic clock events
	BUG: spinlock trylock failure on UP on CPU#0, swapper/0
	 lock: 804db198, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
	...

Revert it for now until the ordering issues can be resolved, or we can get
some more help from the runtime PM framework to make this possible.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

Showing 1 changed file with 2 additions and 10 deletions Side-by-side Diff

drivers/clocksource/sh_tmu.c
... ... @@ -25,7 +25,6 @@
25 25 #include <linux/delay.h>
26 26 #include <linux/io.h>
27 27 #include <linux/clk.h>
28   -#include <linux/pm_runtime.h>
29 28 #include <linux/irq.h>
30 29 #include <linux/err.h>
31 30 #include <linux/clocksource.h>
32 31  
... ... @@ -110,12 +109,10 @@
110 109 {
111 110 int ret;
112 111  
113   - /* wake up device and enable clock */
114   - pm_runtime_get_sync(&p->pdev->dev);
  112 + /* enable clock */
115 113 ret = clk_enable(p->clk);
116 114 if (ret) {
117 115 dev_err(&p->pdev->dev, "cannot enable clock\n");
118   - pm_runtime_put_sync(&p->pdev->dev);
119 116 return ret;
120 117 }
121 118  
122 119  
... ... @@ -144,9 +141,8 @@
144 141 /* disable interrupts in TMU block */
145 142 sh_tmu_write(p, TCR, 0x0000);
146 143  
147   - /* stop clock and mark device as idle */
  144 + /* stop clock */
148 145 clk_disable(p->clk);
149   - pm_runtime_put_sync(&p->pdev->dev);
150 146 }
151 147  
152 148 static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta,
... ... @@ -415,7 +411,6 @@
415 411  
416 412 if (p) {
417 413 dev_info(&pdev->dev, "kept as earlytimer\n");
418   - pm_runtime_enable(&pdev->dev);
419 414 return 0;
420 415 }
421 416  
... ... @@ -430,9 +425,6 @@
430 425 kfree(p);
431 426 platform_set_drvdata(pdev, NULL);
432 427 }
433   -
434   - if (!is_early_platform_device(pdev))
435   - pm_runtime_enable(&pdev->dev);
436 428 return ret;
437 429 }
438 430