alistair23-linux/drivers/base
Rafael J. Wysocki e1866b33b1 PM / Runtime: Rework runtime PM handling during driver removal
The driver core tries to prevent race conditions between runtime PM
and driver removal from happening by incrementing the runtime PM
usage counter of the device and executing pm_runtime_barrier() before
running the bus notifier and the ->remove() callbacks provided by the
device's subsystem or driver.  This guarantees that, if a future
runtime suspend of the device has been scheduled or a runtime resume
or idle request has been queued up right before the driver removal,
it will be canceled or waited for to complete and no other
asynchronous runtime suspend or idle requests for the device will be
put into the PM workqueue until the ->remove() callback returns.
However, it doesn't prevent resume requests from being queued up
after pm_runtime_barrier() has been called and it doesn't prevent
pm_runtime_resume() from executing the device subsystem's runtime
resume callback.  Morever, it prevents the device's subsystem or
driver from putting the device into the suspended state by calling
pm_runtime_suspend() from its ->remove() routine.  This turns out to
be a major inconvenience for some subsystems and drivers that want to
leave the devices they handle in the suspended state.

To really prevent runtime PM callbacks from racing with the bus
notifier callback in __device_release_driver(), which is necessary,
because the notifier is used by some subsystems to carry out
operations affecting the runtime PM functionality, use
pm_runtime_get_sync() instead of the combination of
pm_runtime_get_noresume() and pm_runtime_barrier().  This will resume
the device if it's in the suspended state and will prevent it from
being suspended again until pm_runtime_put_*() is called.

To allow subsystems and drivers to put devices into the suspended
state by calling pm_runtime_suspend() from their ->remove() routines,
execute pm_runtime_put_sync() after running the bus notifier in
__device_release_driver().  This will require subsystems and drivers
to make their ->remove() callbacks avoid races with runtime PM
directly, but it will allow of more flexibility in the handling of
devices during the removal of their drivers.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-05-17 23:19:17 +02:00
..
power PM / Wakeup: Fix initialization of wakeup-related device sysfs files 2011-04-26 11:33:09 +02:00
attribute_container.c
base.h driver-core: merge private parts of class and bus 2010-11-17 14:21:08 -08:00
bus.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-01-13 10:05:56 -08:00
class.c driver-core: merge private parts of class and bus 2010-11-17 14:21:08 -08:00
core.c driver core: Replace the dangerous to_root_device macro with an inline function 2011-02-03 16:36:40 -08:00
cpu.c
dd.c PM / Runtime: Rework runtime PM handling during driver removal 2011-05-17 23:19:17 +02:00
devres.c
devtmpfs.c convert get_sb_single() users 2010-10-29 04:16:28 -04:00
dma-coherent.c
dma-mapping.c
driver.c
firmware.c
firmware_class.c firmware_classs: change val uevent's type to bool 2011-02-03 15:39:17 -08:00
hypervisor.c
init.c
iommu.c
isa.c
Kconfig Introduce ARCH_NO_SYSDEV_OPS config option (v2) 2011-03-23 22:16:41 +01:00
Makefile PM / Core: Introduce struct syscore_ops for core subsystems PM 2011-03-15 00:43:46 +01:00
map.c
memory.c memory hotplug: sysfs probe routine should add all memory sections 2011-02-03 16:08:58 -08:00
module.c
node.c memory hotplug: Update phys_index to [start|end]_section_nr 2011-02-03 16:08:57 -08:00
platform.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6 2011-04-12 17:18:05 -07:00
sys.c Fix common misspellings 2011-03-31 11:26:23 -03:00
syscore.c PM: Add missing syscore_suspend() and syscore_resume() calls 2011-04-20 00:36:11 +02:00
topology.c
transport_class.c