summaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-01-29 20:39:02 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-21 09:37:30 -0700
commit3142788b7967ccfd2f1813ee9e11aeb1e1cf7de2 (patch)
tree292a6e3a21e237789c91a8d0ccd021321990a265 /include/linux/device.h
parent190e8370b8033f746db5289e9324174564a6f5a7 (diff)
downloadblackbird-op-linux-3142788b7967ccfd2f1813ee9e11aeb1e1cf7de2.tar.gz
blackbird-op-linux-3142788b7967ccfd2f1813ee9e11aeb1e1cf7de2.zip
drivers/base: Convert dev->sem to mutex
The semaphore is semantically a mutex. Convert it to a real mutex and fix up a few places where code was relying on semaphore.h to be included by device.h, as well as the users of the trylock function, as that value is now reversed. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 241b96bcd7ad..6f9619190aaf 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,7 +22,6 @@
#include <linux/types.h>
#include <linux/module.h>
#include <linux/pm.h>
-#include <linux/semaphore.h>
#include <asm/atomic.h>
#include <asm/device.h>
@@ -404,7 +403,7 @@ struct device {
const char *init_name; /* initial name of the device */
struct device_type *type;
- struct semaphore sem; /* semaphore to synchronize calls to
+ struct mutex mutex; /* mutex to synchronize calls to
* its driver.
*/
@@ -514,17 +513,17 @@ static inline bool device_async_suspend_enabled(struct device *dev)
static inline void device_lock(struct device *dev)
{
- down(&dev->sem);
+ mutex_lock(&dev->mutex);
}
static inline int device_trylock(struct device *dev)
{
- return down_trylock(&dev->sem);
+ return mutex_trylock(&dev->mutex);
}
static inline void device_unlock(struct device *dev)
{
- up(&dev->sem);
+ mutex_unlock(&dev->mutex);
}
void driver_init(void);
OpenPOWER on IntegriCloud