aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvision/usbvision-video.c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-10-24 16:31:15 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:00:55 -0500
commit289d4d2f0746715ada41e0945116eb3d62d5f35c (patch)
treedfb7dc29cd73101db3c3dc83a6835a1b2748955c /drivers/media/video/usbvision/usbvision-video.c
parentb02044d81fc028d4fef1c65f9b179a0aec091f0b (diff)
V4L/DVB (6400): usbvision: Convert the usbvision->lock semaphore to the mutex API
Convert the usbvision->lock semaphore to the mutex API Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Reviewed-by: Thierry MERLE <thierry.merle@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-video.c')
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 36e689fa16c0..e34f311124e3 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -410,7 +410,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file)
410 410
411 /* If so far no errors then we shall start the camera */ 411 /* If so far no errors then we shall start the camera */
412 if (!errCode) { 412 if (!errCode) {
413 down(&usbvision->lock); 413 mutex_lock(&usbvision->lock);
414 if (usbvision->power == 0) { 414 if (usbvision->power == 0) {
415 usbvision_power_on(usbvision); 415 usbvision_power_on(usbvision);
416 usbvision_i2c_register(usbvision); 416 usbvision_i2c_register(usbvision);
@@ -439,7 +439,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file)
439 usbvision->initialized = 0; 439 usbvision->initialized = 0;
440 } 440 }
441 } 441 }
442 up(&usbvision->lock); 442 mutex_unlock(&usbvision->lock);
443 } 443 }
444 444
445 if (errCode) { 445 if (errCode) {
@@ -467,7 +467,7 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file)
467 (struct usb_usbvision *) video_get_drvdata(dev); 467 (struct usb_usbvision *) video_get_drvdata(dev);
468 468
469 PDEBUG(DBG_IO, "close"); 469 PDEBUG(DBG_IO, "close");
470 down(&usbvision->lock); 470 mutex_lock(&usbvision->lock);
471 471
472 usbvision_audio_off(usbvision); 472 usbvision_audio_off(usbvision);
473 usbvision_restart_isoc(usbvision); 473 usbvision_restart_isoc(usbvision);
@@ -487,7 +487,7 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file)
487 usbvision->initialized = 0; 487 usbvision->initialized = 0;
488 } 488 }
489 489
490 up(&usbvision->lock); 490 mutex_unlock(&usbvision->lock);
491 491
492 if (usbvision->remove_pending) { 492 if (usbvision->remove_pending) {
493 printk(KERN_INFO "%s: Final disconnect\n", __FUNCTION__); 493 printk(KERN_INFO "%s: Final disconnect\n", __FUNCTION__);
@@ -647,13 +647,13 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int input)
647 if ((input >= usbvision->video_inputs) || (input < 0) ) 647 if ((input >= usbvision->video_inputs) || (input < 0) )
648 return -EINVAL; 648 return -EINVAL;
649 649
650 down(&usbvision->lock); 650 mutex_lock(&usbvision->lock);
651 usbvision_muxsel(usbvision, input); 651 usbvision_muxsel(usbvision, input);
652 usbvision_set_input(usbvision); 652 usbvision_set_input(usbvision);
653 usbvision_set_output(usbvision, 653 usbvision_set_output(usbvision,
654 usbvision->curwidth, 654 usbvision->curwidth,
655 usbvision->curheight); 655 usbvision->curheight);
656 up(&usbvision->lock); 656 mutex_unlock(&usbvision->lock);
657 return 0; 657 return 0;
658} 658}
659 659
@@ -664,10 +664,10 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id)
664 (struct usb_usbvision *) video_get_drvdata(dev); 664 (struct usb_usbvision *) video_get_drvdata(dev);
665 usbvision->tvnormId=*id; 665 usbvision->tvnormId=*id;
666 666
667 down(&usbvision->lock); 667 mutex_lock(&usbvision->lock);
668 call_i2c_clients(usbvision, VIDIOC_S_STD, 668 call_i2c_clients(usbvision, VIDIOC_S_STD,
669 &usbvision->tvnormId); 669 &usbvision->tvnormId);
670 up(&usbvision->lock); 670 mutex_unlock(&usbvision->lock);
671 /* propagate the change to the decoder */ 671 /* propagate the change to the decoder */
672 usbvision_muxsel(usbvision, usbvision->ctl_input); 672 usbvision_muxsel(usbvision, usbvision->ctl_input);
673 673
@@ -1083,9 +1083,9 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
1083 usbvision->curFrame = NULL; 1083 usbvision->curFrame = NULL;
1084 1084
1085 /* by now we are committed to the new data... */ 1085 /* by now we are committed to the new data... */
1086 down(&usbvision->lock); 1086 mutex_lock(&usbvision->lock);
1087 usbvision_set_output(usbvision, vf->fmt.pix.width, vf->fmt.pix.height); 1087 usbvision_set_output(usbvision, vf->fmt.pix.width, vf->fmt.pix.height);
1088 up(&usbvision->lock); 1088 mutex_unlock(&usbvision->lock);
1089 1089
1090 return 0; 1090 return 0;
1091} 1091}
@@ -1211,16 +1211,16 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
1211 1211
1212 PDEBUG(DBG_MMAP, "mmap"); 1212 PDEBUG(DBG_MMAP, "mmap");
1213 1213
1214 down(&usbvision->lock); 1214 mutex_lock(&usbvision->lock);
1215 1215
1216 if (!USBVISION_IS_OPERATIONAL(usbvision)) { 1216 if (!USBVISION_IS_OPERATIONAL(usbvision)) {
1217 up(&usbvision->lock); 1217 mutex_unlock(&usbvision->lock);
1218 return -EFAULT; 1218 return -EFAULT;
1219 } 1219 }
1220 1220
1221 if (!(vma->vm_flags & VM_WRITE) || 1221 if (!(vma->vm_flags & VM_WRITE) ||
1222 size != PAGE_ALIGN(usbvision->max_frame_size)) { 1222 size != PAGE_ALIGN(usbvision->max_frame_size)) {
1223 up(&usbvision->lock); 1223 mutex_unlock(&usbvision->lock);
1224 return -EINVAL; 1224 return -EINVAL;
1225 } 1225 }
1226 1226
@@ -1232,7 +1232,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
1232 if (i == usbvision->num_frames) { 1232 if (i == usbvision->num_frames) {
1233 PDEBUG(DBG_MMAP, 1233 PDEBUG(DBG_MMAP,
1234 "mmap: user supplied mapping address is out of range"); 1234 "mmap: user supplied mapping address is out of range");
1235 up(&usbvision->lock); 1235 mutex_unlock(&usbvision->lock);
1236 return -EINVAL; 1236 return -EINVAL;
1237 } 1237 }
1238 1238
@@ -1245,7 +1245,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
1245 1245
1246 if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { 1246 if (vm_insert_page(vma, start, vmalloc_to_page(pos))) {
1247 PDEBUG(DBG_MMAP, "mmap: vm_insert_page failed"); 1247 PDEBUG(DBG_MMAP, "mmap: vm_insert_page failed");
1248 up(&usbvision->lock); 1248 mutex_unlock(&usbvision->lock);
1249 return -EAGAIN; 1249 return -EAGAIN;
1250 } 1250 }
1251 start += PAGE_SIZE; 1251 start += PAGE_SIZE;
@@ -1253,7 +1253,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
1253 size -= PAGE_SIZE; 1253 size -= PAGE_SIZE;
1254 } 1254 }
1255 1255
1256 up(&usbvision->lock); 1256 mutex_unlock(&usbvision->lock);
1257 return 0; 1257 return 0;
1258} 1258}
1259 1259
@@ -1271,7 +1271,7 @@ static int usbvision_radio_open(struct inode *inode, struct file *file)
1271 1271
1272 PDEBUG(DBG_IO, "%s:", __FUNCTION__); 1272 PDEBUG(DBG_IO, "%s:", __FUNCTION__);
1273 1273
1274 down(&usbvision->lock); 1274 mutex_lock(&usbvision->lock);
1275 1275
1276 if (usbvision->user) { 1276 if (usbvision->user) {
1277 err("%s: Someone tried to open an already opened USBVision Radio!", __FUNCTION__); 1277 err("%s: Someone tried to open an already opened USBVision Radio!", __FUNCTION__);
@@ -1307,7 +1307,7 @@ static int usbvision_radio_open(struct inode *inode, struct file *file)
1307 usbvision->initialized = 0; 1307 usbvision->initialized = 0;
1308 } 1308 }
1309 } 1309 }
1310 up(&usbvision->lock); 1310 mutex_unlock(&usbvision->lock);
1311 return errCode; 1311 return errCode;
1312} 1312}
1313 1313
@@ -1321,7 +1321,7 @@ static int usbvision_radio_close(struct inode *inode, struct file *file)
1321 1321
1322 PDEBUG(DBG_IO, ""); 1322 PDEBUG(DBG_IO, "");
1323 1323
1324 down(&usbvision->lock); 1324 mutex_lock(&usbvision->lock);
1325 1325
1326 /* Set packet size to 0 */ 1326 /* Set packet size to 0 */
1327 usbvision->ifaceAlt=0; 1327 usbvision->ifaceAlt=0;
@@ -1337,7 +1337,7 @@ static int usbvision_radio_close(struct inode *inode, struct file *file)
1337 usbvision->initialized = 0; 1337 usbvision->initialized = 0;
1338 } 1338 }
1339 1339
1340 up(&usbvision->lock); 1340 mutex_unlock(&usbvision->lock);
1341 1341
1342 if (usbvision->remove_pending) { 1342 if (usbvision->remove_pending) {
1343 printk(KERN_INFO "%s: Final disconnect\n", __FUNCTION__); 1343 printk(KERN_INFO "%s: Final disconnect\n", __FUNCTION__);
@@ -1641,7 +1641,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev)
1641 1641
1642 usbvision->dev = dev; 1642 usbvision->dev = dev;
1643 1643
1644 init_MUTEX(&usbvision->lock); /* to 1 == available */ 1644 mutex_init(&usbvision->lock); /* available */
1645 1645
1646 // prepare control urb for control messages during interrupts 1646 // prepare control urb for control messages during interrupts
1647 usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); 1647 usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
@@ -1676,13 +1676,13 @@ static void usbvision_release(struct usb_usbvision *usbvision)
1676{ 1676{
1677 PDEBUG(DBG_PROBE, ""); 1677 PDEBUG(DBG_PROBE, "");
1678 1678
1679 down(&usbvision->lock); 1679 mutex_lock(&usbvision->lock);
1680 1680
1681 usbvision_reset_powerOffTimer(usbvision); 1681 usbvision_reset_powerOffTimer(usbvision);
1682 1682
1683 usbvision->initialized = 0; 1683 usbvision->initialized = 0;
1684 1684
1685 up(&usbvision->lock); 1685 mutex_unlock(&usbvision->lock);
1686 1686
1687 usbvision_remove_sysfs(usbvision->vdev); 1687 usbvision_remove_sysfs(usbvision->vdev);
1688 usbvision_unregister_video(usbvision); 1688 usbvision_unregister_video(usbvision);
@@ -1796,7 +1796,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
1796 } 1796 }
1797 PDEBUG(DBG_PROBE, "bridgeType %d", usbvision->bridgeType); 1797 PDEBUG(DBG_PROBE, "bridgeType %d", usbvision->bridgeType);
1798 1798
1799 down(&usbvision->lock); 1799 mutex_lock(&usbvision->lock);
1800 1800
1801 /* compute alternate max packet sizes */ 1801 /* compute alternate max packet sizes */
1802 uif = dev->actconfig->interface[0]; 1802 uif = dev->actconfig->interface[0];
@@ -1840,7 +1840,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
1840 usbvision->streaming = Stream_Off; 1840 usbvision->streaming = Stream_Off;
1841 usbvision_register_video(usbvision); 1841 usbvision_register_video(usbvision);
1842 usbvision_configure_video(usbvision); 1842 usbvision_configure_video(usbvision);
1843 up(&usbvision->lock); 1843 mutex_unlock(&usbvision->lock);
1844 1844
1845 1845
1846 usb_set_intfdata (intf, usbvision); 1846 usb_set_intfdata (intf, usbvision);
@@ -1871,7 +1871,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
1871 } 1871 }
1872 usb_set_intfdata (intf, NULL); 1872 usb_set_intfdata (intf, NULL);
1873 1873
1874 down(&usbvision->lock); 1874 mutex_lock(&usbvision->lock);
1875 1875
1876 // At this time we ask to cancel outstanding URBs 1876 // At this time we ask to cancel outstanding URBs
1877 usbvision_stop_isoc(usbvision); 1877 usbvision_stop_isoc(usbvision);
@@ -1885,7 +1885,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
1885 usb_put_dev(usbvision->dev); 1885 usb_put_dev(usbvision->dev);
1886 usbvision->dev = NULL; // USB device is no more 1886 usbvision->dev = NULL; // USB device is no more
1887 1887
1888 up(&usbvision->lock); 1888 mutex_unlock(&usbvision->lock);
1889 1889
1890 if (usbvision->user) { 1890 if (usbvision->user) {
1891 printk(KERN_INFO "%s: In use, disconnect pending\n", 1891 printk(KERN_INFO "%s: In use, disconnect pending\n",