diff options
author | mochel@digitalimplant.org <mochel@digitalimplant.org> | 2005-03-21 13:41:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-20 18:15:12 -0400 |
commit | af70316af182f4716cc5eec7e0d27fc731d164bd (patch) | |
tree | 22fa4732c8270db8fd3f681355cd83e4b8088847 /include | |
parent | eb51b65005737b777e0709683b061d5f82aefd97 (diff) |
[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 'include')
-rw-r--r-- | include/linux/device.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 68a95358013d..195b327f3e19 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -264,6 +264,10 @@ struct device { | |||
264 | struct kobject kobj; | 264 | struct kobject kobj; |
265 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 265 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
266 | 266 | ||
267 | struct semaphore sem; /* semaphore to synchronize calls to | ||
268 | * its driver. | ||
269 | */ | ||
270 | |||
267 | struct bus_type * bus; /* type of bus device is on */ | 271 | struct bus_type * bus; /* type of bus device is on */ |
268 | struct device_driver *driver; /* which driver has allocated this | 272 | struct device_driver *driver; /* which driver has allocated this |
269 | device */ | 273 | device */ |