]> Pileus Git - ~andy/linux/blobdiff - drivers/media/radio/radio-shark.c
[media] radio-shark*: Call cancel_work_sync from disconnect rather then release
[~andy/linux] / drivers / media / radio / radio-shark.c
index d0b6bb507634a5756e7c5d6335a42f8da2b0d90f..1d76afa9e1b78baca8cacd7111ea0b6d6cdf7aea 100644 (file)
@@ -181,14 +181,6 @@ static void shark_led_work(struct work_struct *work)
                container_of(work, struct shark_device, led_work);
        int i, res, brightness, actual_len;
 
-       /*
-        * We use the v4l2_dev lock and registered bit to ensure the device
-        * does not get unplugged and unreffed while we're running.
-        */
-       mutex_lock(&shark->tea.mutex);
-       if (!video_is_registered(&shark->tea.vd))
-               goto leave;
-
        for (i = 0; i < 3; i++) {
                if (!test_and_clear_bit(i, &shark->brightness_new))
                        continue;
@@ -208,8 +200,6 @@ static void shark_led_work(struct work_struct *work)
                        v4l2_err(&shark->v4l2_dev, "set LED %s error: %d\n",
                                 shark->led_names[i], res);
        }
-leave:
-       mutex_unlock(&shark->tea.mutex);
 }
 
 static void shark_led_set_blue(struct led_classdev *led_cdev,
@@ -259,6 +249,8 @@ static void usb_shark_disconnect(struct usb_interface *intf)
        for (i = 0; i < NO_LEDS; i++)
                led_classdev_unregister(&shark->leds[i]);
 
+       cancel_work_sync(&shark->led_work);
+
        v4l2_device_put(&shark->v4l2_dev);
 }
 
@@ -266,7 +258,6 @@ static void usb_shark_release(struct v4l2_device *v4l2_dev)
 {
        struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev);
 
-       cancel_work_sync(&shark->led_work);
        v4l2_device_unregister(&shark->v4l2_dev);
        kfree(shark->transfer_buffer);
        kfree(shark);
@@ -286,15 +277,6 @@ static int usb_shark_probe(struct usb_interface *intf,
        if (!shark->transfer_buffer)
                goto err_alloc_buffer;
 
-       /*
-        * Work around a bug in usbhid/hid-core.c, where it leaves a dangling
-        * pointer in intfdata causing v4l2-device.c to not set it. Which
-        * results in usb_shark_disconnect() referencing the dangling pointer
-        *
-        * REMOVE (as soon as the above bug is fixed, patch submitted)
-        */
-       usb_set_intfdata(intf, NULL);
-
        shark->v4l2_dev.release = usb_shark_release;
        v4l2_device_set_name(&shark->v4l2_dev, DRV_NAME, &shark_instance);
        retval = v4l2_device_register(&intf->dev, &shark->v4l2_dev);