Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219518
b: refs/heads/master
c: a682d4c
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Oct 23, 2010
1 parent f1cc6b7 commit f1fbb9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e2302501c32a0e7e34b7077f10da03b72dd91570
refs/heads/master: a682d4cb768381039bdafdc3c04c53cf8d70dcf0
17 changes: 14 additions & 3 deletions trunk/drivers/media/radio/radio-mr800.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,13 @@ static void usb_amradio_disconnect(struct usb_interface *intf)
struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));

mutex_lock(&radio->lock);
/* increase the device node's refcount */
get_device(&radio->videodev.dev);
v4l2_device_disconnect(&radio->v4l2_dev);
mutex_unlock(&radio->lock);
video_unregister_device(&radio->videodev);
mutex_unlock(&radio->lock);
/* decrease the device node's refcount, allowing it to be released */
put_device(&radio->videodev.dev);
}

/* vidioc_querycap - query device capabilities */
Expand Down Expand Up @@ -515,7 +519,8 @@ static int usb_amradio_close(struct file *file)
{
struct amradio_device *radio = file->private_data;

usb_autopm_put_interface(radio->intf);
if (video_is_registered(&radio->videodev))
usb_autopm_put_interface(radio->intf);
return 0;
}

Expand All @@ -524,10 +529,12 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
{
struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));

mutex_lock(&radio->lock);
if (!radio->muted && radio->initialized) {
amradio_set_mute(radio, AMRADIO_STOP);
radio->muted = 0;
}
mutex_unlock(&radio->lock);

dev_info(&intf->dev, "going into suspend..\n");
return 0;
Expand All @@ -538,8 +545,9 @@ static int usb_amradio_resume(struct usb_interface *intf)
{
struct amradio_device *radio = to_amradio_dev(usb_get_intfdata(intf));

mutex_lock(&radio->lock);
if (unlikely(!radio->initialized))
return 0;
goto unlock;

if (radio->stereo)
amradio_set_stereo(radio, WANT_STEREO);
Expand All @@ -551,6 +559,9 @@ static int usb_amradio_resume(struct usb_interface *intf)
if (!radio->muted)
amradio_set_mute(radio, AMRADIO_START);

unlock:
mutex_unlock(&radio->lock);

dev_info(&intf->dev, "coming out of suspend..\n");
return 0;
}
Expand Down

0 comments on commit f1fbb9c

Please sign in to comment.