From: Alexey Klimov <klimov.linux@gmail.com>
To: Douglas Schilling Landgraf <dougsland@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: [patch review 4/6] radio-mr800: make radio->status variable
Date: Sat, 08 Aug 2009 21:46:08 +0400 [thread overview]
Message-ID: <1249753568.15160.249.camel@tux.localhost> (raw)
Remove radio->muted and radio->removed variables from amradio_device
structure. Instead patch creates radio->status variable and updates
code.
Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
--
diff -r a1ccdea5a182 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c Wed Jul 29 12:42:06 2009 +0400
+++ b/linux/drivers/media/radio/radio-mr800.c Sat Aug 08 17:24:05 2009 +0400
@@ -108,6 +108,8 @@
#define AMRADIO_START 0x00
#define AMRADIO_STOP 0x01
+#define DISCONNECTED -1
+
/* Comfortable defines for amradio_set_stereo */
#define WANT_STEREO 0x00
#define WANT_MONO 0x01
@@ -135,11 +137,10 @@
unsigned char *buffer;
struct mutex lock; /* buffer locking */
+ int status;
int curfreq;
int stereo;
int users;
- int removed;
- int muted;
};
/* USB Device ID List */
@@ -172,7 +173,7 @@
int size;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
mutex_lock(&radio->lock);
@@ -194,7 +195,7 @@
return retval;
}
- radio->muted = argument;
+ radio->status = argument;
mutex_unlock(&radio->lock);
@@ -209,7 +210,7 @@
unsigned short freq_send = 0x10 + (radio->curfreq >> 3) / 25;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
mutex_lock(&radio->lock);
@@ -259,7 +260,7 @@
int size;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
mutex_lock(&radio->lock);
@@ -299,7 +300,7 @@
struct amradio_device *radio = usb_get_intfdata(intf);
mutex_lock(&radio->lock);
- radio->removed = 1;
+ radio->status = DISCONNECTED;
mutex_unlock(&radio->lock);
usb_set_intfdata(intf, NULL);
@@ -329,7 +330,7 @@
int retval;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
if (v->index > 0)
@@ -371,7 +372,7 @@
int retval;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
if (v->index > 0)
@@ -406,7 +407,7 @@
int retval;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
mutex_lock(&radio->lock);
@@ -427,7 +428,7 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
f->type = V4L2_TUNER_RADIO;
@@ -454,12 +455,12 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
- ctrl->value = radio->muted;
+ ctrl->value = radio->status;
return 0;
}
return -EINVAL;
@@ -473,7 +474,7 @@
int retval;
/* safety check */
- if (radio->removed)
+ if (unlikely(radio->status == DISCONNECTED))
return -EIO;
switch (ctrl->id) {
@@ -540,7 +541,6 @@
struct amradio_device *radio = video_get_drvdata(video_devdata(file));
radio->users = 1;
- radio->muted = 1;
return 0;
}
@@ -674,7 +674,7 @@
radio->videodev->ioctl_ops = &usb_amradio_ioctl_ops;
radio->videodev->release = usb_amradio_video_device_release;
- radio->removed = 0;
+ radio->status = AMRADIO_STOP;
radio->users = 0;
radio->usbdev = interface_to_usbdev(intf);
radio->curfreq = 95.16 * FREQ_MUL;
--
Best regards, Klimov Alexey
next reply other threads:[~2009-08-08 17:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-08 17:46 Alexey Klimov [this message]
2009-08-10 22:16 ` [patch review 4/6] radio-mr800: make radio->status variable David Ellingsworth
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=1249753568.15160.249.camel@tux.localhost \
--to=klimov.linux@gmail.com \
--cc=dougsland@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