aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/stv680.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@infradead.org>2006-01-11 09:55:29 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 17:49:55 -0500
commit4186ecf8ad16dd05759a09594de6a87e48759ba6 (patch)
tree3ee5292d9f4a36e3eb359b586289ec972bcbaf39 /drivers/usb/media/stv680.c
parent35cce732d9d4d9af6b4ad4d26d8f8c0eddb573a2 (diff)
[PATCH] USB: convert a bunch of USB semaphores to mutexes
the patch below converts a bunch of semaphores-used-as-mutex in the USB code to mutexes Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/media/stv680.c')
-rw-r--r--drivers/usb/media/stv680.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/usb/media/stv680.c b/drivers/usb/media/stv680.c
index b497a6a0a20..b1a6be2958e 100644
--- a/drivers/usb/media/stv680.c
+++ b/drivers/usb/media/stv680.c
@@ -67,6 +67,7 @@
67#include <linux/errno.h> 67#include <linux/errno.h>
68#include <linux/videodev.h> 68#include <linux/videodev.h>
69#include <linux/usb.h> 69#include <linux/usb.h>
70#include <linux/mutex.h>
70 71
71#include "stv680.h" 72#include "stv680.h"
72 73
@@ -1258,22 +1259,22 @@ static int stv680_mmap (struct file *file, struct vm_area_struct *vma)
1258 unsigned long size = vma->vm_end-vma->vm_start; 1259 unsigned long size = vma->vm_end-vma->vm_start;
1259 unsigned long page, pos; 1260 unsigned long page, pos;
1260 1261
1261 down (&stv680->lock); 1262 mutex_lock(&stv680->lock);
1262 1263
1263 if (stv680->udev == NULL) { 1264 if (stv680->udev == NULL) {
1264 up (&stv680->lock); 1265 mutex_unlock(&stv680->lock);
1265 return -EIO; 1266 return -EIO;
1266 } 1267 }
1267 if (size > (((STV680_NUMFRAMES * stv680->maxframesize) + PAGE_SIZE - 1) 1268 if (size > (((STV680_NUMFRAMES * stv680->maxframesize) + PAGE_SIZE - 1)
1268 & ~(PAGE_SIZE - 1))) { 1269 & ~(PAGE_SIZE - 1))) {
1269 up (&stv680->lock); 1270 mutex_unlock(&stv680->lock);
1270 return -EINVAL; 1271 return -EINVAL;
1271 } 1272 }
1272 pos = (unsigned long) stv680->fbuf; 1273 pos = (unsigned long) stv680->fbuf;
1273 while (size > 0) { 1274 while (size > 0) {
1274 page = vmalloc_to_pfn((void *)pos); 1275 page = vmalloc_to_pfn((void *)pos);
1275 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) { 1276 if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
1276 up (&stv680->lock); 1277 mutex_unlock(&stv680->lock);
1277 return -EAGAIN; 1278 return -EAGAIN;
1278 } 1279 }
1279 start += PAGE_SIZE; 1280 start += PAGE_SIZE;
@@ -1283,7 +1284,7 @@ static int stv680_mmap (struct file *file, struct vm_area_struct *vma)
1283 else 1284 else
1284 size = 0; 1285 size = 0;
1285 } 1286 }
1286 up (&stv680->lock); 1287 mutex_unlock(&stv680->lock);
1287 1288
1288 return 0; 1289 return 0;
1289} 1290}
@@ -1409,7 +1410,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
1409 1410
1410 memcpy (stv680->vdev->name, stv680->camera_name, strlen (stv680->camera_name)); 1411 memcpy (stv680->vdev->name, stv680->camera_name, strlen (stv680->camera_name));
1411 init_waitqueue_head (&stv680->wq); 1412 init_waitqueue_head (&stv680->wq);
1412 init_MUTEX (&stv680->lock); 1413 mutex_init (&stv680->lock);
1413 wmb (); 1414 wmb ();
1414 1415
1415 if (video_register_device (stv680->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { 1416 if (video_register_device (stv680->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {