summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authormochel@digitalimplant.org <mochel@digitalimplant.org>2005-03-21 10:41:04 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-20 15:15:12 -0700
commitaf70316af182f4716cc5eec7e0d27fc731d164bd (patch)
tree22fa4732c8270db8fd3f681355cd83e4b8088847 /drivers/base/core.c
parenteb51b65005737b777e0709683b061d5f82aefd97 (diff)
downloadblackbird-op-linux-af70316af182f4716cc5eec7e0d27fc731d164bd.tar.gz
blackbird-op-linux-af70316af182f4716cc5eec7e0d27fc731d164bd.zip
[PATCH] Add a semaphore to struct device to synchronize calls to its driver.
This adds a per-device semaphore that is taken before every call from the core to a driver method. This prevents e.g. simultaneous calls to the ->suspend() or ->resume() and ->probe() or ->release(), potentially saving a whole lot of headaches. It also moves us a step closer to removing the bus rwsem, since it protects the fields in struct device that are modified by the core. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index a293a788abd4..93440824b800 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -212,6 +212,7 @@ void device_initialize(struct device *dev)
INIT_LIST_HEAD(&dev->driver_list);
INIT_LIST_HEAD(&dev->bus_list);
INIT_LIST_HEAD(&dev->dma_pools);
+ init_MUTEX(&dev->sem);
}
/**
OpenPOWER on IntegriCloud