public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ellingsworth <david@identd.dyndns.org>
To: linux-media@vger.kernel.org, klimov.linux@gmail.com
Subject: [RFC/RFT 07/10] radio-mr800: remove device removed indicator
Date: Sat, 12 Sep 2009 10:49:53 -0400	[thread overview]
Message-ID: <4AABB511.7060705@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2476 bytes --]

 From a9b0a308892919514efc692f2a0e28b80ea304ac Mon Sep 17 00:00:00 2001
From: David Ellingsworth <david@identd.dyndns.org>
Date: Sat, 12 Sep 2009 01:22:57 -0400
Subject: [PATCH 07/10] mr800: remove device removed indicator

Signed-off-by: David Ellingsworth <david@identd.dyndns.org>
---
 drivers/media/radio/radio-mr800.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/media/radio/radio-mr800.c 
b/drivers/media/radio/radio-mr800.c
index 71d15ba..9fd2342 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -137,7 +137,6 @@ struct amradio_device {
     int curfreq;
     int stereo;
     int users;
-    int removed;
     int muted;
 };
 
@@ -270,7 +269,7 @@ static void usb_amradio_disconnect(struct 
usb_interface *intf)
     struct amradio_device *radio = usb_get_intfdata(intf);
 
     mutex_lock(&radio->lock);
-    radio->removed = 1;
+    radio->usbdev = NULL;
     mutex_unlock(&radio->lock);
 
     usb_set_intfdata(intf, NULL);
@@ -488,7 +487,7 @@ static int usb_amradio_open(struct file *file)
 
     mutex_lock(&radio->lock);
 
-    if (radio->removed) {
+    if (!radio->usbdev) {
         retval = -EIO;
         goto unlock;
     }
@@ -528,19 +527,17 @@ static int usb_amradio_close(struct file *file)
 
     mutex_lock(&radio->lock);
 
-    if (radio->removed) {
+    if (!radio->usbdev) {
         retval = -EIO;
         goto unlock;
     }
 
     radio->users = 0;
 
-    if (!radio->removed) {
-        retval = amradio_set_mute(radio, AMRADIO_STOP);
-        if (retval < 0)
-            amradio_dev_warn(&radio->videodev.dev,
-                "amradio_stop failed\n");
-    }
+    retval = amradio_set_mute(radio, AMRADIO_STOP);
+    if (retval < 0)
+        amradio_dev_warn(&radio->videodev.dev,
+            "amradio_stop failed\n");
 
 unlock:
     mutex_unlock(&radio->lock);
@@ -555,7 +552,7 @@ static long usb_amradio_ioctl(struct file *file, 
unsigned int cmd,
 
     mutex_lock(&radio->lock);
 
-    if (radio->removed) {
+    if (!radio->usbdev) {
         retval = -EIO;
         goto unlock;
     }
@@ -673,7 +670,6 @@ static int usb_amradio_probe(struct usb_interface *intf,
     radio->videodev.ioctl_ops = &usb_amradio_ioctl_ops;
     radio->videodev.release = usb_amradio_video_device_release;
 
-    radio->removed = 0;
     radio->users = 0;
     radio->usbdev = interface_to_usbdev(intf);
     radio->curfreq = 95.16 * FREQ_MUL;
-- 
1.6.3.3


[-- Attachment #2: 0007-mr800-remove-device-removed-indicator.patch --]
[-- Type: text/x-diff, Size: 2284 bytes --]

>From a9b0a308892919514efc692f2a0e28b80ea304ac Mon Sep 17 00:00:00 2001
From: David Ellingsworth <david@identd.dyndns.org>
Date: Sat, 12 Sep 2009 01:22:57 -0400
Subject: [PATCH 07/10] mr800: remove device removed indicator

Signed-off-by: David Ellingsworth <david@identd.dyndns.org>
---
 drivers/media/radio/radio-mr800.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 71d15ba..9fd2342 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -137,7 +137,6 @@ struct amradio_device {
 	int curfreq;
 	int stereo;
 	int users;
-	int removed;
 	int muted;
 };
 
@@ -270,7 +269,7 @@ static void usb_amradio_disconnect(struct usb_interface *intf)
 	struct amradio_device *radio = usb_get_intfdata(intf);
 
 	mutex_lock(&radio->lock);
-	radio->removed = 1;
+	radio->usbdev = NULL;
 	mutex_unlock(&radio->lock);
 
 	usb_set_intfdata(intf, NULL);
@@ -488,7 +487,7 @@ static int usb_amradio_open(struct file *file)
 
 	mutex_lock(&radio->lock);
 
-	if (radio->removed) {
+	if (!radio->usbdev) {
 		retval = -EIO;
 		goto unlock;
 	}
@@ -528,19 +527,17 @@ static int usb_amradio_close(struct file *file)
 
 	mutex_lock(&radio->lock);
 
-	if (radio->removed) {
+	if (!radio->usbdev) {
 		retval = -EIO;
 		goto unlock;
 	}
 
 	radio->users = 0;
 
-	if (!radio->removed) {
-		retval = amradio_set_mute(radio, AMRADIO_STOP);
-		if (retval < 0)
-			amradio_dev_warn(&radio->videodev.dev,
-				"amradio_stop failed\n");
-	}
+	retval = amradio_set_mute(radio, AMRADIO_STOP);
+	if (retval < 0)
+		amradio_dev_warn(&radio->videodev.dev,
+			"amradio_stop failed\n");
 
 unlock:
 	mutex_unlock(&radio->lock);
@@ -555,7 +552,7 @@ static long usb_amradio_ioctl(struct file *file, unsigned int cmd,
 
 	mutex_lock(&radio->lock);
 
-	if (radio->removed) {
+	if (!radio->usbdev) {
 		retval = -EIO;
 		goto unlock;
 	}
@@ -673,7 +670,6 @@ static int usb_amradio_probe(struct usb_interface *intf,
 	radio->videodev.ioctl_ops = &usb_amradio_ioctl_ops;
 	radio->videodev.release = usb_amradio_video_device_release;
 
-	radio->removed = 0;
 	radio->users = 0;
 	radio->usbdev = interface_to_usbdev(intf);
 	radio->curfreq = 95.16 * FREQ_MUL;
-- 
1.6.3.3


                 reply	other threads:[~2009-09-12 14:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AABB511.7060705@gmail.com \
    --to=david@identd.dyndns.org \
    --cc=klimov.linux@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox