diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-02 16:55:02 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-02 16:55:02 -0300 |
commit | 24b1cf4ab4be6bebbdc0c76a2ad7d25a39ce7d3f (patch) | |
tree | b326863f704290d43c8861f13bd773f9cca798d6 /linux/drivers/media/video/vivi.c | |
parent | d531e1dbeb7dad87f971e1d651c925b11e99b9cb (diff) | |
parent | b08432f588a4161f12dd8419a2673ba582c9d3ab (diff) | |
download | mediapointer-dvb-s2-24b1cf4ab4be6bebbdc0c76a2ad7d25a39ce7d3f.tar.gz mediapointer-dvb-s2-24b1cf4ab4be6bebbdc0c76a2ad7d25a39ce7d3f.tar.bz2 |
merge: http://www.linuxtv.org/hg/~tmerle/v4l-dvb
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/vivi.c')
-rw-r--r-- | linux/drivers/media/video/vivi.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index 0cea7c28b..bd418e590 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -25,6 +25,11 @@ #include <linux/pci.h> #include <linux/random.h> #include <linux/version.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) +#include <linux/mutex.h> +#else +#include <asm/semaphore.h> +#endif #include "compat.h" #include <linux/videodev2.h> #include <linux/dma-mapping.h> @@ -177,7 +182,11 @@ static LIST_HEAD(vivi_devlist); struct vivi_dev { struct list_head vivi_devlist; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) + struct mutex lock; +#else struct semaphore lock; +#endif int users; @@ -970,16 +979,16 @@ static struct videobuf_queue_ops vivi_video_qops = { static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) { /* is it free? */ - down(&dev->lock); + mutex_lock(&dev->lock); if (dev->resources) { /* no, someone else uses it */ - up(&dev->lock); + mutex_unlock(&dev->lock); return 0; } /* it's free, grab it */ dev->resources =1; dprintk(1,"res: get\n"); - up(&dev->lock); + mutex_unlock(&dev->lock); return 1; } @@ -990,10 +999,10 @@ static int res_locked(struct vivi_dev *dev) static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) { - down(&dev->lock); + mutex_lock(&dev->lock); dev->resources = 0; dprintk(1,"res: put\n"); - up(&dev->lock); + mutex_lock(&dev->lock); } /* ------------------------------------------------------------------ @@ -1506,7 +1515,7 @@ static int __init vivi_init(void) init_waitqueue_head(&dev->vidq.wq); /* initialize locks */ - init_MUTEX(&dev->lock); + mutex_init(&dev->lock); dev->vidq.timeout.function = vivi_vid_timeout; dev->vidq.timeout.data = (unsigned long)dev; |