aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/media/usbvideo.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/usbvideo.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/usbvideo.c')
-rw-r--r--drivers/usb/media/usbvideo.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/usb/media/usbvideo.c b/drivers/usb/media/usbvideo.c
index 63d279ec722b..0b51fae720a9 100644
--- a/drivers/usb/media/usbvideo.c
+++ b/drivers/usb/media/usbvideo.c
@@ -714,7 +714,7 @@ int usbvideo_register(
714 cams->md_module = md; 714 cams->md_module = md;
715 if (cams->md_module == NULL) 715 if (cams->md_module == NULL)
716 warn("%s: module == NULL!", __FUNCTION__); 716 warn("%s: module == NULL!", __FUNCTION__);
717 init_MUTEX(&cams->lock); /* to 1 == available */ 717 mutex_init(&cams->lock); /* to 1 == available */
718 718
719 for (i = 0; i < num_cams; i++) { 719 for (i = 0; i < num_cams; i++) {
720 struct uvd *up = &cams->cam[i]; 720 struct uvd *up = &cams->cam[i];
@@ -862,7 +862,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf)
862 if (uvd->debug > 0) 862 if (uvd->debug > 0)
863 info("%s(%p.)", __FUNCTION__, intf); 863 info("%s(%p.)", __FUNCTION__, intf);
864 864
865 down(&uvd->lock); 865 mutex_lock(&uvd->lock);
866 uvd->remove_pending = 1; /* Now all ISO data will be ignored */ 866 uvd->remove_pending = 1; /* Now all ISO data will be ignored */
867 867
868 /* At this time we ask to cancel outstanding URBs */ 868 /* At this time we ask to cancel outstanding URBs */
@@ -882,7 +882,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf)
882 info("%s: In use, disconnect pending.", __FUNCTION__); 882 info("%s: In use, disconnect pending.", __FUNCTION__);
883 else 883 else
884 usbvideo_CameraRelease(uvd); 884 usbvideo_CameraRelease(uvd);
885 up(&uvd->lock); 885 mutex_unlock(&uvd->lock);
886 info("USB camera disconnected."); 886 info("USB camera disconnected.");
887 887
888 usbvideo_ClientDecModCount(uvd); 888 usbvideo_ClientDecModCount(uvd);
@@ -929,19 +929,19 @@ static int usbvideo_find_struct(struct usbvideo *cams)
929 err("No usbvideo handle?"); 929 err("No usbvideo handle?");
930 return -1; 930 return -1;
931 } 931 }
932 down(&cams->lock); 932 mutex_lock(&cams->lock);
933 for (u = 0; u < cams->num_cameras; u++) { 933 for (u = 0; u < cams->num_cameras; u++) {
934 struct uvd *uvd = &cams->cam[u]; 934 struct uvd *uvd = &cams->cam[u];
935 if (!uvd->uvd_used) /* This one is free */ 935 if (!uvd->uvd_used) /* This one is free */
936 { 936 {
937 uvd->uvd_used = 1; /* In use now */ 937 uvd->uvd_used = 1; /* In use now */
938 init_MUTEX(&uvd->lock); /* to 1 == available */ 938 mutex_init(&uvd->lock); /* to 1 == available */
939 uvd->dev = NULL; 939 uvd->dev = NULL;
940 rv = u; 940 rv = u;
941 break; 941 break;
942 } 942 }
943 } 943 }
944 up(&cams->lock); 944 mutex_unlock(&cams->lock);
945 return rv; 945 return rv;
946} 946}
947 947
@@ -983,7 +983,7 @@ struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
983 /* Not relying upon caller we increase module counter ourselves */ 983 /* Not relying upon caller we increase module counter ourselves */
984 usbvideo_ClientIncModCount(uvd); 984 usbvideo_ClientIncModCount(uvd);
985 985
986 down(&uvd->lock); 986 mutex_lock(&uvd->lock);
987 for (i=0; i < USBVIDEO_NUMSBUF; i++) { 987 for (i=0; i < USBVIDEO_NUMSBUF; i++) {
988 uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL); 988 uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
989 if (uvd->sbuf[i].urb == NULL) { 989 if (uvd->sbuf[i].urb == NULL) {
@@ -1006,7 +1006,7 @@ struct uvd *usbvideo_AllocateDevice(struct usbvideo *cams)
1006 * return control to the client's probe function right now. 1006 * return control to the client's probe function right now.
1007 */ 1007 */
1008allocate_done: 1008allocate_done:
1009 up (&uvd->lock); 1009 mutex_unlock(&uvd->lock);
1010 usbvideo_ClientDecModCount(uvd); 1010 usbvideo_ClientDecModCount(uvd);
1011 return uvd; 1011 return uvd;
1012} 1012}
@@ -1120,7 +1120,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1120 info("%s($%p)", __FUNCTION__, dev); 1120 info("%s($%p)", __FUNCTION__, dev);
1121 1121
1122 usbvideo_ClientIncModCount(uvd); 1122 usbvideo_ClientIncModCount(uvd);
1123 down(&uvd->lock); 1123 mutex_lock(&uvd->lock);
1124 1124
1125 if (uvd->user) { 1125 if (uvd->user) {
1126 err("%s: Someone tried to open an already opened device!", __FUNCTION__); 1126 err("%s: Someone tried to open an already opened device!", __FUNCTION__);
@@ -1201,7 +1201,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1201 } 1201 }
1202 } 1202 }
1203 } 1203 }
1204 up(&uvd->lock); 1204 mutex_unlock(&uvd->lock);
1205 if (errCode != 0) 1205 if (errCode != 0)
1206 usbvideo_ClientDecModCount(uvd); 1206 usbvideo_ClientDecModCount(uvd);
1207 if (uvd->debug > 0) 1207 if (uvd->debug > 0)
@@ -1230,7 +1230,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
1230 if (uvd->debug > 1) 1230 if (uvd->debug > 1)
1231 info("%s($%p)", __FUNCTION__, dev); 1231 info("%s($%p)", __FUNCTION__, dev);
1232 1232
1233 down(&uvd->lock); 1233 mutex_lock(&uvd->lock);
1234 GET_CALLBACK(uvd, stopDataPump)(uvd); 1234 GET_CALLBACK(uvd, stopDataPump)(uvd);
1235 usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size); 1235 usbvideo_rvfree(uvd->fbuf, uvd->fbuf_size);
1236 uvd->fbuf = NULL; 1236 uvd->fbuf = NULL;
@@ -1251,7 +1251,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
1251 info("usbvideo_v4l_close: Final disconnect."); 1251 info("usbvideo_v4l_close: Final disconnect.");
1252 usbvideo_CameraRelease(uvd); 1252 usbvideo_CameraRelease(uvd);
1253 } 1253 }
1254 up(&uvd->lock); 1254 mutex_unlock(&uvd->lock);
1255 usbvideo_ClientDecModCount(uvd); 1255 usbvideo_ClientDecModCount(uvd);
1256 1256
1257 if (uvd->debug > 1) 1257 if (uvd->debug > 1)
@@ -1511,7 +1511,7 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf,
1511 if (uvd->debug >= 1) 1511 if (uvd->debug >= 1)
1512 info("%s: %Zd. bytes, noblock=%d.", __FUNCTION__, count, noblock); 1512 info("%s: %Zd. bytes, noblock=%d.", __FUNCTION__, count, noblock);
1513 1513
1514 down(&uvd->lock); 1514 mutex_lock(&uvd->lock);
1515 1515
1516 /* See if a frame is completed, then use it. */ 1516 /* See if a frame is completed, then use it. */
1517 for(i = 0; i < USBVIDEO_NUMFRAMES; i++) { 1517 for(i = 0; i < USBVIDEO_NUMFRAMES; i++) {
@@ -1643,7 +1643,7 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf,
1643 } 1643 }
1644 } 1644 }
1645read_done: 1645read_done:
1646 up(&uvd->lock); 1646 mutex_unlock(&uvd->lock);
1647 return count; 1647 return count;
1648} 1648}
1649 1649