[media] usbvision: move init code to probe()
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 20 Jul 2015 12:59:38 +0000 (09:59 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 11 Aug 2015 09:55:26 +0000 (06:55 -0300)
These things are only initialized if you start streaming video, but
they are also used in the disconnect function. So just init them
always during probe time.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/usbvision/usbvision-core.c
drivers/media/usb/usbvision/usbvision-video.c

index 9f4e63083e28cdc4f0ec8440318796a68fd6830a..dc3b4d5155c5e391724a8df14abe4cbde3c2c2fb 100644 (file)
@@ -1791,10 +1791,6 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision, int number_of_frames
                usbvision->num_frames--;
        }
 
-       spin_lock_init(&usbvision->queue_lock);
-       init_waitqueue_head(&usbvision->wait_frame);
-       init_waitqueue_head(&usbvision->wait_stream);
-
        /* Allocate all buffers */
        for (i = 0; i < usbvision->num_frames; i++) {
                usbvision->frame[i].index = i;
index 6ad3d568d495a33b8c2eacef251cf555ee51674b..b693206f66dd3d05462aa59f88bd6445aaed88f4 100644 (file)
@@ -1520,6 +1520,10 @@ static int usbvision_probe(struct usb_interface *intf,
 
        usbvision->nr = usbvision_nr++;
 
+       spin_lock_init(&usbvision->queue_lock);
+       init_waitqueue_head(&usbvision->wait_frame);
+       init_waitqueue_head(&usbvision->wait_stream);
+
        usbvision->have_tuner = usbvision_device_data[model].tuner;
        if (usbvision->have_tuner)
                usbvision->tuner_type = usbvision_device_data[model].tuner_type;