]> err.no Git - linux-2.6/commitdiff
V4L/DVB (5572): Pvrusb2: use mutex instead of semaphore
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Sat, 28 Apr 2007 23:00:18 +0000 (20:00 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 9 May 2007 13:12:31 +0000 (10:12 -0300)
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>
drivers/media/video/pvrusb2/pvrusb2-hdw.c

index acf651e01f94aeebff01dd7e82c1a19832a75b09..1311891e7ee3dd0d85acc751c0ad40362271e3c4 100644 (file)
@@ -83,7 +83,7 @@ static struct pvr2_string_table pvr2_client_lists[] = {
 };
 
 static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL};
-static DECLARE_MUTEX(pvr2_unit_sem);
+static DEFINE_MUTEX(pvr2_unit_mtx);
 
 static int ctlchg = 0;
 static int initusbreset = 1;
@@ -2076,14 +2076,14 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
        hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL);
        if (!hdw->ctl_read_urb) goto fail;
 
-       down(&pvr2_unit_sem); do {
+       mutex_lock(&pvr2_unit_mtx); do {
                for (idx = 0; idx < PVR_NUM; idx++) {
                        if (unit_pointers[idx]) continue;
                        hdw->unit_number = idx;
                        unit_pointers[idx] = hdw;
                        break;
                }
-       } while (0); up(&pvr2_unit_sem);
+       } while (0); mutex_unlock(&pvr2_unit_mtx);
 
        cnt1 = 0;
        cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2");
@@ -2186,13 +2186,13 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
        }
        pvr2_i2c_core_done(hdw);
        pvr2_hdw_remove_usb_stuff(hdw);
-       down(&pvr2_unit_sem); do {
+       mutex_lock(&pvr2_unit_mtx); do {
                if ((hdw->unit_number >= 0) &&
                    (hdw->unit_number < PVR_NUM) &&
                    (unit_pointers[hdw->unit_number] == hdw)) {
                        unit_pointers[hdw->unit_number] = NULL;
                }
-       } while (0); up(&pvr2_unit_sem);
+       } while (0); mutex_unlock(&pvr2_unit_mtx);
        kfree(hdw->controls);
        kfree(hdw->mpeg_ctrl_info);
        kfree(hdw->std_defs);