aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-07-02 09:19:38 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:24:29 -0400
commit51b540292a349b380ccc0572401c6ac343acdf4a (patch)
treec56359a90424bfffcf9f190242228eea26f9bd7c /drivers
parentb9378fdbc334d1575b492108eac822a78c0c46d9 (diff)
V4L/DVB (5811): Use mutex instead of semaphore in Virtual Video driver
The Virtual Video driver uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/vivi.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 582c6ba7c608..f6d3a9460ccc 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -25,6 +25,7 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/random.h> 26#include <linux/random.h>
27#include <linux/version.h> 27#include <linux/version.h>
28#include <linux/mutex.h>
28#include <linux/videodev2.h> 29#include <linux/videodev2.h>
29#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
30#ifdef CONFIG_VIDEO_V4L1_COMPAT 31#ifdef CONFIG_VIDEO_V4L1_COMPAT
@@ -165,7 +166,7 @@ static LIST_HEAD(vivi_devlist);
165struct vivi_dev { 166struct vivi_dev {
166 struct list_head vivi_devlist; 167 struct list_head vivi_devlist;
167 168
168 struct semaphore lock; 169 struct mutex lock;
169 170
170 int users; 171 int users;
171 172
@@ -738,16 +739,16 @@ static struct videobuf_queue_ops vivi_video_qops = {
738static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) 739static int res_get(struct vivi_dev *dev, struct vivi_fh *fh)
739{ 740{
740 /* is it free? */ 741 /* is it free? */
741 down(&dev->lock); 742 mutex_lock(&dev->lock);
742 if (dev->resources) { 743 if (dev->resources) {
743 /* no, someone else uses it */ 744 /* no, someone else uses it */
744 up(&dev->lock); 745 mutex_unlock(&dev->lock);
745 return 0; 746 return 0;
746 } 747 }
747 /* it's free, grab it */ 748 /* it's free, grab it */
748 dev->resources =1; 749 dev->resources =1;
749 dprintk(1,"res: get\n"); 750 dprintk(1,"res: get\n");
750 up(&dev->lock); 751 mutex_unlock(&dev->lock);
751 return 1; 752 return 1;
752} 753}
753 754
@@ -758,10 +759,10 @@ static int res_locked(struct vivi_dev *dev)
758 759
759static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) 760static void res_free(struct vivi_dev *dev, struct vivi_fh *fh)
760{ 761{
761 down(&dev->lock); 762 mutex_lock(&dev->lock);
762 dev->resources = 0; 763 dev->resources = 0;
763 dprintk(1,"res: put\n"); 764 dprintk(1,"res: put\n");
764 up(&dev->lock); 765 mutex_lock(&dev->lock);
765} 766}
766 767
767/* ------------------------------------------------------------------ 768/* ------------------------------------------------------------------
@@ -1260,7 +1261,7 @@ static int __init vivi_init(void)
1260 init_waitqueue_head(&dev->vidq.wq); 1261 init_waitqueue_head(&dev->vidq.wq);
1261 1262
1262 /* initialize locks */ 1263 /* initialize locks */
1263 init_MUTEX(&dev->lock); 1264 mutex_init(&dev->lock);
1264 1265
1265 dev->vidq.timeout.function = vivi_vid_timeout; 1266 dev->vidq.timeout.function = vivi_vid_timeout;
1266 dev->vidq.timeout.data = (unsigned long)dev; 1267 dev->vidq.timeout.data = (unsigned long)dev;