Rafael J. Wysocki 048be431e4 sh-sci / PM: Avoid deadlocking runtime PM
The runtime PM of sh-sci devices is enabled when sci_probe() returns,
so the pm_runtime_put_sync() executed by driver_probe_device()
attempts to suspend the device.  Then, in some situations, a
diagnostic message is printed to the console by one of the runtime
suspend routines handling the sh-sci device, which causes synchronous
runtime resume to be started from the device's own runtime suspend
callback.  This causes rpm_resume() to be run eventually, which sees
the RPM_SUSPENDING status set by rpm_suspend() and waits for it to
change.  However, the device's runtime PM status cannot change at
that point, because the routine that has set it waits for the
rpm_suspend() to return.  A deadlock occurs as a result.

To avoid that make sci_init_single() increment the device's
runtime PM usage counter, so that it cannot be suspended by
driver_probe_device().  That counter has to be decremented
eventually, so make sci_startup() do that before starting to
actually use the device and make sci_shutdown() increment it
again before returning to balance the incrementation carried out by
sci_startup().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2012-03-09 12:59:44 +09:00
..
2011-09-22 16:08:57 -07:00
2011-07-26 16:49:47 -07:00
2011-09-22 16:08:57 -07:00
2011-09-22 16:08:57 -07:00
2011-03-31 11:26:23 -03:00
2011-11-08 10:10:20 -08:00
2011-12-09 19:11:35 -08:00
2011-11-17 11:42:09 -08:00
2011-03-31 11:26:23 -03:00
2012-01-03 22:54:07 -05:00
2011-08-23 10:34:07 -07:00