usbvision: Convert semaphore to mutex
PATCH 1/1 usbvision: Convert semaphore to mutex
usbvision: Convert the usbvision->lock semaphore to the mutex API
Signed-off-by Matthias Kaehlcke <[email protected]>
--
drivers/media/video/usbvision/usbvision-core.c +6 -2
@@ -2242,14 +2242,18 @@ static void call_usbvision_power_off(struct work_struct *work) struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, powerOffWork);PDEBUG (DBG_FUNC ,"" ); -down_interruptible (&usbvision->lock); +if (mutex_lock_interruptible (&usbvision->lock)) { +return ; + } + +if (usbvision->user ==0 ) {usbvision_i2c_unregister (usbvision);usbvision_power_off (usbvision); usbvision->initialized =0 ; } -up (&usbvision->lock); +mutex_unlock (&usbvision->lock); }static void usbvision_powerOffTimer (unsigned long data)
drivers/media/video/usbvision/usbvision-video.c +27 -27
200 lines not on this page · raw message
drivers/media/video/usbvision/usbvision.h +2 -1
@@ -34,6 +34,7 @@#include <linux/list.h> #include <linux/usb.h> #include <linux/i2c.h> +#include <linux/mutex.h> #include <media/v4l2-common.h> #include <media/tuner.h> #include <linux/videodev2.h>
@@ -396,7 +397,7 @@ struct usb_usbvision {unsigned char iface;/* Video interface number */ unsigned char ifaceAlt;/* Alt settings */ unsigned char Vin_Reg2_Preset; -struct semaphore lock; +struct mutex lock;struct timer_list powerOffTimer;struct work_struct powerOffWork;int power;/* is the device powered on? */
Signature · 12 lines
Matthias Kaehlcke
Linux Application Developer
Barcelona
Representation of the world, like the world itself, is
the work of men; they describe it from their own point
of view, which they confuse with the absolute truth
(Simone de Beauvoir)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-Hello,
Quoted 3 lines · Matthias Kaehlcke
usbvision: Convert the
usbvision->locksemaphore to the mutex API
I adapted your patch to the v4l-dvb hg tree
(http://linuxtv.org/hg/~tmerle/v4l-dvb) thanks.
Thierry