aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-mr800.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/radio/radio-mr800.c')
-rw-r--r--drivers/media/radio/radio-mr800.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 0498c4c60d8c..c4f4cd8dbb6c 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -137,7 +137,6 @@ struct amradio_device {
137 int curfreq; 137 int curfreq;
138 int stereo; 138 int stereo;
139 int users; 139 int users;
140 int removed;
141 int muted; 140 int muted;
142}; 141};
143 142
@@ -270,7 +269,7 @@ static void usb_amradio_disconnect(struct usb_interface *intf)
270 struct amradio_device *radio = usb_get_intfdata(intf); 269 struct amradio_device *radio = usb_get_intfdata(intf);
271 270
272 mutex_lock(&radio->lock); 271 mutex_lock(&radio->lock);
273 radio->removed = 1; 272 radio->usbdev = NULL;
274 mutex_unlock(&radio->lock); 273 mutex_unlock(&radio->lock);
275 274
276 usb_set_intfdata(intf, NULL); 275 usb_set_intfdata(intf, NULL);
@@ -488,7 +487,7 @@ static int usb_amradio_open(struct file *file)
488 487
489 mutex_lock(&radio->lock); 488 mutex_lock(&radio->lock);
490 489
491 if (radio->removed) { 490 if (!radio->usbdev) {
492 retval = -EIO; 491 retval = -EIO;
493 goto unlock; 492 goto unlock;
494 } 493 }
@@ -528,19 +527,17 @@ static int usb_amradio_close(struct file *file)
528 527
529 mutex_lock(&radio->lock); 528 mutex_lock(&radio->lock);
530 529
531 if (radio->removed) { 530 if (!radio->usbdev) {
532 retval = -EIO; 531 retval = -EIO;
533 goto unlock; 532 goto unlock;
534 } 533 }
535 534
536 radio->users = 0; 535 radio->users = 0;
537 536
538 if (!radio->removed) { 537 retval = amradio_set_mute(radio, AMRADIO_STOP);
539 retval = amradio_set_mute(radio, AMRADIO_STOP); 538 if (retval < 0)
540 if (retval < 0) 539 amradio_dev_warn(&radio->videodev.dev,
541 amradio_dev_warn(&radio->videodev.dev, 540 "amradio_stop failed\n");
542 "amradio_stop failed\n");
543 }
544 541
545unlock: 542unlock:
546 mutex_unlock(&radio->lock); 543 mutex_unlock(&radio->lock);
@@ -555,7 +552,7 @@ static long usb_amradio_ioctl(struct file *file, unsigned int cmd,
555 552
556 mutex_lock(&radio->lock); 553 mutex_lock(&radio->lock);
557 554
558 if (radio->removed) { 555 if (!radio->usbdev) {
559 retval = -EIO; 556 retval = -EIO;
560 goto unlock; 557 goto unlock;
561 } 558 }
@@ -673,7 +670,6 @@ static int usb_amradio_probe(struct usb_interface *intf,
673 radio->videodev.ioctl_ops = &usb_amradio_ioctl_ops; 670 radio->videodev.ioctl_ops = &usb_amradio_ioctl_ops;
674 radio->videodev.release = usb_amradio_video_device_release; 671 radio->videodev.release = usb_amradio_video_device_release;
675 672
676 radio->removed = 0;
677 radio->users = 0; 673 radio->users = 0;
678 radio->usbdev = interface_to_usbdev(intf); 674 radio->usbdev = interface_to_usbdev(intf);
679 radio->curfreq = 95.16 * FREQ_MUL; 675 radio->curfreq = 95.16 * FREQ_MUL;