aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-01-29 15:39:02 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-21 12:37:30 -0400
commit3142788b7967ccfd2f1813ee9e11aeb1e1cf7de2 (patch)
tree292a6e3a21e237789c91a8d0ccd021321990a265 /include/linux
parent190e8370b8033f746db5289e9324174564a6f5a7 (diff)
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')
-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 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/semaphore.h>
26#include <asm/atomic.h> 25#include <asm/atomic.h>
27#include <asm/device.h> 26#include <asm/device.h>
28 27
@@ -404,7 +403,7 @@ struct device {
404 const char *init_name; /* initial name of the device */ 403 const char *init_name; /* initial name of the device */
405 struct device_type *type; 404 struct device_type *type;
406 405
407 struct semaphore sem; /* semaphore to synchronize calls to 406 struct mutex mutex; /* mutex to synchronize calls to
408 * its driver. 407 * its driver.
409 */ 408 */
410 409
@@ -514,17 +513,17 @@ static inline bool device_async_suspend_enabled(struct device *dev)
514 513
515static inline void device_lock(struct device *dev) 514static inline void device_lock(struct device *dev)
516{ 515{
517 down(&dev->sem); 516 mutex_lock(&dev->mutex);
518} 517}
519 518
520static inline int device_trylock(struct device *dev) 519static inline int device_trylock(struct device *dev)
521{ 520{
522 return down_trylock(&dev->sem); 521 return mutex_trylock(&dev->mutex);
523} 522}
524 523
525static inline void device_unlock(struct device *dev) 524static inline void device_unlock(struct device *dev)
526{ 525{
527 up(&dev->sem); 526 mutex_unlock(&dev->mutex);
528} 527}
529 528
530void driver_init(void); 529void driver_init(void);