aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/vino.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-02-07 03:49:14 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-02-07 03:49:14 -0500
commit3593cab5d62c4c7abced1076710f9bc2d8847433 (patch)
treedd5dc21961f6b4aef6900b0c2eb63ce7c70aecd5 /drivers/media/video/vino.c
parent538f9630afbbe429ecbcdcf92536200293a8e4b3 (diff)
V4L/DVB (3318b): sem2mutex: drivers/media/, #2
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/vino.c')
-rw-r--r--drivers/media/video/vino.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index c8fd8238904d..0229819d0aac 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -42,6 +42,7 @@
42#include <linux/videodev.h> 42#include <linux/videodev.h>
43#include <linux/videodev2.h> 43#include <linux/videodev2.h>
44#include <linux/video_decoder.h> 44#include <linux/video_decoder.h>
45#include <linux/mutex.h>
45 46
46#include <asm/paccess.h> 47#include <asm/paccess.h>
47#include <asm/io.h> 48#include <asm/io.h>
@@ -245,7 +246,7 @@ struct vino_framebuffer_queue {
245 struct vino_framebuffer *buffer[VINO_FRAMEBUFFER_COUNT_MAX]; 246 struct vino_framebuffer *buffer[VINO_FRAMEBUFFER_COUNT_MAX];
246 247
247 spinlock_t queue_lock; 248 spinlock_t queue_lock;
248 struct semaphore queue_sem; 249 struct mutex queue_mutex;
249 wait_queue_head_t frame_wait_queue; 250 wait_queue_head_t frame_wait_queue;
250}; 251};
251 252
@@ -283,7 +284,7 @@ struct vino_channel_settings {
283 /* the driver is currently processing the queue */ 284 /* the driver is currently processing the queue */
284 int capturing; 285 int capturing;
285 286
286 struct semaphore sem; 287 struct mutex mutex;
287 spinlock_t capture_lock; 288 spinlock_t capture_lock;
288 289
289 unsigned int users; 290 unsigned int users;
@@ -1131,11 +1132,11 @@ static void vino_queue_free(struct vino_framebuffer_queue *q)
1131 if (q->type != VINO_MEMORY_MMAP) 1132 if (q->type != VINO_MEMORY_MMAP)
1132 return; 1133 return;
1133 1134
1134 down(&q->queue_sem); 1135 mutex_lock(&q->queue_mutex);
1135 1136
1136 vino_queue_free_with_count(q, q->length); 1137 vino_queue_free_with_count(q, q->length);
1137 1138
1138 up(&q->queue_sem); 1139 mutex_unlock(&q->queue_mutex);
1139} 1140}
1140 1141
1141static int vino_queue_init(struct vino_framebuffer_queue *q, 1142static int vino_queue_init(struct vino_framebuffer_queue *q,
@@ -1159,7 +1160,7 @@ static int vino_queue_init(struct vino_framebuffer_queue *q,
1159 if (*length < 1) 1160 if (*length < 1)
1160 return -EINVAL; 1161 return -EINVAL;
1161 1162
1162 down(&q->queue_sem); 1163 mutex_lock(&q->queue_mutex);
1163 1164
1164 if (*length > VINO_FRAMEBUFFER_COUNT_MAX) 1165 if (*length > VINO_FRAMEBUFFER_COUNT_MAX)
1165 *length = VINO_FRAMEBUFFER_COUNT_MAX; 1166 *length = VINO_FRAMEBUFFER_COUNT_MAX;
@@ -1211,7 +1212,7 @@ static int vino_queue_init(struct vino_framebuffer_queue *q,
1211 q->magic = VINO_QUEUE_MAGIC; 1212 q->magic = VINO_QUEUE_MAGIC;
1212 } 1213 }
1213 1214
1214 up(&q->queue_sem); 1215 mutex_unlock(&q->queue_mutex);
1215 1216
1216 return ret; 1217 return ret;
1217} 1218}
@@ -4045,7 +4046,7 @@ static int vino_open(struct inode *inode, struct file *file)
4045 dprintk("open(): channel = %c\n", 4046 dprintk("open(): channel = %c\n",
4046 (vcs->channel == VINO_CHANNEL_A) ? 'A' : 'B'); 4047 (vcs->channel == VINO_CHANNEL_A) ? 'A' : 'B');
4047 4048
4048 down(&vcs->sem); 4049 mutex_lock(&vcs->mutex);
4049 4050
4050 if (vcs->users) { 4051 if (vcs->users) {
4051 dprintk("open(): driver busy\n"); 4052 dprintk("open(): driver busy\n");
@@ -4062,7 +4063,7 @@ static int vino_open(struct inode *inode, struct file *file)
4062 vcs->users++; 4063 vcs->users++;
4063 4064
4064 out: 4065 out:
4065 up(&vcs->sem); 4066 mutex_unlock(&vcs->mutex);
4066 4067
4067 dprintk("open(): %s!\n", ret ? "failed" : "complete"); 4068 dprintk("open(): %s!\n", ret ? "failed" : "complete");
4068 4069
@@ -4075,7 +4076,7 @@ static int vino_close(struct inode *inode, struct file *file)
4075 struct vino_channel_settings *vcs = video_get_drvdata(dev); 4076 struct vino_channel_settings *vcs = video_get_drvdata(dev);
4076 dprintk("close():\n"); 4077 dprintk("close():\n");
4077 4078
4078 down(&vcs->sem); 4079 mutex_lock(&vcs->mutex);
4079 4080
4080 vcs->users--; 4081 vcs->users--;
4081 4082
@@ -4087,7 +4088,7 @@ static int vino_close(struct inode *inode, struct file *file)
4087 vino_queue_free(&vcs->fb_queue); 4088 vino_queue_free(&vcs->fb_queue);
4088 } 4089 }
4089 4090
4090 up(&vcs->sem); 4091 mutex_unlock(&vcs->mutex);
4091 4092
4092 return 0; 4093 return 0;
4093} 4094}
@@ -4130,7 +4131,7 @@ static int vino_mmap(struct file *file, struct vm_area_struct *vma)
4130 4131
4131 // TODO: reject mmap if already mapped 4132 // TODO: reject mmap if already mapped
4132 4133
4133 if (down_interruptible(&vcs->sem)) 4134 if (mutex_lock_interruptible(&vcs->mutex))
4134 return -EINTR; 4135 return -EINTR;
4135 4136
4136 if (vcs->reading) { 4137 if (vcs->reading) {
@@ -4214,7 +4215,7 @@ found:
4214 vma->vm_ops = &vino_vm_ops; 4215 vma->vm_ops = &vino_vm_ops;
4215 4216
4216out: 4217out:
4217 up(&vcs->sem); 4218 mutex_unlock(&vcs->mutex);
4218 4219
4219 return ret; 4220 return ret;
4220} 4221}
@@ -4374,12 +4375,12 @@ static int vino_ioctl(struct inode *inode, struct file *file,
4374 struct vino_channel_settings *vcs = video_get_drvdata(dev); 4375 struct vino_channel_settings *vcs = video_get_drvdata(dev);
4375 int ret; 4376 int ret;
4376 4377
4377 if (down_interruptible(&vcs->sem)) 4378 if (mutex_lock_interruptible(&vcs->mutex))
4378 return -EINTR; 4379 return -EINTR;
4379 4380
4380 ret = video_usercopy(inode, file, cmd, arg, vino_do_ioctl); 4381 ret = video_usercopy(inode, file, cmd, arg, vino_do_ioctl);
4381 4382
4382 up(&vcs->sem); 4383 mutex_unlock(&vcs->mutex);
4383 4384
4384 return ret; 4385 return ret;
4385} 4386}
@@ -4564,10 +4565,10 @@ static int vino_init_channel_settings(struct vino_channel_settings *vcs,
4564 4565
4565 vcs->capturing = 0; 4566 vcs->capturing = 0;
4566 4567
4567 init_MUTEX(&vcs->sem); 4568 mutex_init(&vcs->mutex);
4568 spin_lock_init(&vcs->capture_lock); 4569 spin_lock_init(&vcs->capture_lock);
4569 4570
4570 init_MUTEX(&vcs->fb_queue.queue_sem); 4571 mutex_init(&vcs->fb_queue.queue_mutex);
4571 spin_lock_init(&vcs->fb_queue.queue_lock); 4572 spin_lock_init(&vcs->fb_queue.queue_lock);
4572 init_waitqueue_head(&vcs->fb_queue.frame_wait_queue); 4573 init_waitqueue_head(&vcs->fb_queue.frame_wait_queue);
4573 4574