]> git.karo-electronics.de Git - karo-tx-linux.git/commit
PM / Runtime: Add might_sleep() to runtime PM functions
authorColin Cross <ccross@android.com>
Mon, 8 Aug 2011 21:39:36 +0000 (23:39 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Mon, 8 Aug 2011 21:39:36 +0000 (23:39 +0200)
commit538ca9226829b07ffd61f37dc51ec2019bd96704
tree68ed46ce75d6c4db9213804f64a59fb40d57df69
parent2f84dd70916ccadd25e94d28363182a978f569b6
PM / Runtime: Add might_sleep() to runtime PM functions

Some of the entry points to pm runtime are not safe to
call in atomic context unless pm_runtime_irq_safe() has
been called.  Inspecting the code, it is not immediately
obvious that the functions sleep at all, as they run
inside a spin_lock_irqsave, but under some conditions
they can drop the lock and turn on irqs.

If a driver incorrectly calls the pm_runtime apis, it can
cause sleeping and irq processing when it expects to stay
in atomic context.

Add might_sleep_if to the majority of the __pm_runtime_* entry points
to enforce correct usage.

Add pm_runtime_put_sync_autosuspend to the list of
functions that can be called in atomic context.

Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Documentation/power/runtime_pm.txt
drivers/base/power/runtime.c