diff --git a/drivers/base/core.c b/drivers/base/core.c index e11c8c3e74165cc172b6ad55fcf1e4fa2548998a..cf507a7d200ce34326e091cbbda82c8b30e73543 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -559,7 +558,7 @@ void device_initialize(struct device *dev) dev->kobj.kset = devices_kset; kobject_init(&dev->kobj, &device_ktype); INIT_LIST_HEAD(&dev->dma_pools); - init_MUTEX(&dev->sem); + mutex_init(&dev->mutex); spin_lock_init(&dev->devres_lock); INIT_LIST_HEAD(&dev->devres_head); device_pm_init(dev); diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index bc72d6e4919b8542b0721b797edd67560e31fb86..13343e8849997d46b0b408e81b7b629f97be9528 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 1786db2f3378ec0e76f418c522e7951f76385525..8b274b70825953382d19539e9f0fbec194104db8 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -48,6 +48,7 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 */ #include "../comedidev.h" +#include #include #include diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 397b678f1c479f577d4f6e8f61426e8c90e60e36..5ae14f6c1e7aca6ecbb860ce795bc4cd8ea1a6d8 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -573,7 +573,7 @@ int usb_lock_device_for_reset(struct usb_device *udev, iface->condition == USB_INTERFACE_UNBOUND)) return -EINTR; - while (usb_trylock_device(udev) != 0) { + while (!usb_trylock_device(udev)) { /* If we can't acquire the lock after waiting one second, * we're probably deadlocked */ diff --git a/include/linux/device.h b/include/linux/device.h index 241b96bcd7ad252c223e264e5b5ce8de09c6e528..6f9619190aafb70f5c3135ff14632080b81ac8fc 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -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);