summaryrefslogtreecommitdiff
path: root/drivers/media/radio/radio-shark2.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-08-11 13:34:53 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-12 20:49:44 +0400
commitcfc1b2a06f87f562da2ffb9f8d1ae4203d9bfbfa (patch)
treec256562f8ca82abfc1a80a19b7b7caaaefdee34b /drivers/media/radio/radio-shark2.c
parent820ddfa6ca87fc12bf202907b77f635df2098e66 (diff)
downloadlinux-cfc1b2a06f87f562da2ffb9f8d1ae4203d9bfbfa.tar.xz
[media] radio-shark*: Call cancel_work_sync from disconnect rather then release
This removes the need for shark_led_work to take the v4l2 lock. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/radio-shark2.c')
-rw-r--r--drivers/media/radio/radio-shark2.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/media/radio/radio-shark2.c b/drivers/media/radio/radio-shark2.c
index fc0289d5da4e..217483ca1b18 100644
--- a/drivers/media/radio/radio-shark2.c
+++ b/drivers/media/radio/radio-shark2.c
@@ -166,13 +166,6 @@ static void shark_led_work(struct work_struct *work)
struct shark_device *shark =
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 < 2; i++) {
if (!test_and_clear_bit(i, &shark->brightness_new))
@@ -191,8 +184,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,
@@ -231,6 +222,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);
}
@@ -238,7 +231,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);