diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-04-28 19:00:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-05-09 09:12:31 -0400 |
commit | 8df0c87cc33646a19a59c0f93c4f9a330d5ca5eb (patch) | |
tree | 35ccbccd3a5a9fbd1b09bf26426eab12ae8d2f66 /drivers/media | |
parent | 5f12491c36acb94670d822a90c9295f6fd671c8a (diff) |
V4L/DVB (5572): Pvrusb2: use mutex instead of semaphore
The pvrusb2 driver use 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: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index acf651e01f94..1311891e7ee3 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -83,7 +83,7 @@ static struct pvr2_string_table pvr2_client_lists[] = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; | 85 | static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; |
86 | static DECLARE_MUTEX(pvr2_unit_sem); | 86 | static DEFINE_MUTEX(pvr2_unit_mtx); |
87 | 87 | ||
88 | static int ctlchg = 0; | 88 | static int ctlchg = 0; |
89 | static int initusbreset = 1; | 89 | static int initusbreset = 1; |
@@ -2076,14 +2076,14 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
2076 | hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL); | 2076 | hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL); |
2077 | if (!hdw->ctl_read_urb) goto fail; | 2077 | if (!hdw->ctl_read_urb) goto fail; |
2078 | 2078 | ||
2079 | down(&pvr2_unit_sem); do { | 2079 | mutex_lock(&pvr2_unit_mtx); do { |
2080 | for (idx = 0; idx < PVR_NUM; idx++) { | 2080 | for (idx = 0; idx < PVR_NUM; idx++) { |
2081 | if (unit_pointers[idx]) continue; | 2081 | if (unit_pointers[idx]) continue; |
2082 | hdw->unit_number = idx; | 2082 | hdw->unit_number = idx; |
2083 | unit_pointers[idx] = hdw; | 2083 | unit_pointers[idx] = hdw; |
2084 | break; | 2084 | break; |
2085 | } | 2085 | } |
2086 | } while (0); up(&pvr2_unit_sem); | 2086 | } while (0); mutex_unlock(&pvr2_unit_mtx); |
2087 | 2087 | ||
2088 | cnt1 = 0; | 2088 | cnt1 = 0; |
2089 | cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2"); | 2089 | cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2"); |
@@ -2186,13 +2186,13 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) | |||
2186 | } | 2186 | } |
2187 | pvr2_i2c_core_done(hdw); | 2187 | pvr2_i2c_core_done(hdw); |
2188 | pvr2_hdw_remove_usb_stuff(hdw); | 2188 | pvr2_hdw_remove_usb_stuff(hdw); |
2189 | down(&pvr2_unit_sem); do { | 2189 | mutex_lock(&pvr2_unit_mtx); do { |
2190 | if ((hdw->unit_number >= 0) && | 2190 | if ((hdw->unit_number >= 0) && |
2191 | (hdw->unit_number < PVR_NUM) && | 2191 | (hdw->unit_number < PVR_NUM) && |
2192 | (unit_pointers[hdw->unit_number] == hdw)) { | 2192 | (unit_pointers[hdw->unit_number] == hdw)) { |
2193 | unit_pointers[hdw->unit_number] = NULL; | 2193 | unit_pointers[hdw->unit_number] = NULL; |
2194 | } | 2194 | } |
2195 | } while (0); up(&pvr2_unit_sem); | 2195 | } while (0); mutex_unlock(&pvr2_unit_mtx); |
2196 | kfree(hdw->controls); | 2196 | kfree(hdw->controls); |
2197 | kfree(hdw->mpeg_ctrl_info); | 2197 | kfree(hdw->mpeg_ctrl_info); |
2198 | kfree(hdw->std_defs); | 2198 | kfree(hdw->std_defs); |