Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173889
b: refs/heads/master
c: eac000a
h: refs/heads/master
i:
  173887: 07811ff
v: v3
  • Loading branch information
David Ellingsworth authored and Mauro Carvalho Chehab committed Dec 5, 2009
1 parent 5272aaf commit b7f1c26
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 80 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: ceb99e1b5a093ae8f439fc55aac28d007145c8ec
refs/heads/master: eac000a90e70b990c7d847ac40ff1c33a5f00636
109 changes: 30 additions & 79 deletions trunk/drivers/media/radio/radio-mr800.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,8 @@ static int vidioc_g_tuner(struct file *file, void *priv,
struct amradio_device *radio = file->private_data;
int retval;

mutex_lock(&radio->lock);

/* safety check */
if (radio->removed) {
retval = -EIO;
goto unlock;
}

if (v->index > 0) {
retval = -EINVAL;
goto unlock;
}
if (v->index > 0)
return -EINVAL;

/* TODO: Add function which look is signal stereo or not
* amradio_getstat(radio);
Expand Down Expand Up @@ -338,8 +328,6 @@ static int vidioc_g_tuner(struct file *file, void *priv,
v->signal = 0xffff; /* Can't get the signal strength, sad.. */
v->afc = 0; /* Don't know what is this */

unlock:
mutex_unlock(&radio->lock);
return retval;
}

Expand All @@ -348,20 +336,10 @@ static int vidioc_s_tuner(struct file *file, void *priv,
struct v4l2_tuner *v)
{
struct amradio_device *radio = file->private_data;
int retval;

mutex_lock(&radio->lock);

/* safety check */
if (radio->removed) {
retval = -EIO;
goto unlock;
}
int retval = -EINVAL;

if (v->index > 0) {
retval = -EINVAL;
goto unlock;
}
if (v->index > 0)
return -EINVAL;

/* mono/stereo selector */
switch (v->audmode) {
Expand All @@ -377,12 +355,8 @@ static int vidioc_s_tuner(struct file *file, void *priv,
amradio_dev_warn(&radio->videodev.dev,
"set stereo failed\n");
break;
default:
retval = -EINVAL;
}

unlock:
mutex_unlock(&radio->lock);
return retval;
}

Expand All @@ -391,15 +365,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
struct amradio_device *radio = file->private_data;
int retval;

mutex_lock(&radio->lock);

/* safety check */
if (radio->removed) {
retval = -EIO;
goto unlock;
}
int retval = 0;

radio->curfreq = f->frequency;

Expand All @@ -408,8 +374,6 @@ static int vidioc_s_frequency(struct file *file, void *priv,
amradio_dev_warn(&radio->videodev.dev,
"set frequency failed\n");

unlock:
mutex_unlock(&radio->lock);
return retval;
}

Expand All @@ -418,22 +382,11 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
struct amradio_device *radio = file->private_data;
int retval = 0;

mutex_lock(&radio->lock);

/* safety check */
if (radio->removed) {
retval = -EIO;
goto unlock;
}

f->type = V4L2_TUNER_RADIO;
f->frequency = radio->curfreq;

unlock:
mutex_unlock(&radio->lock);
return retval;
return 0;
}

/* vidioc_queryctrl - enumerate control items */
Expand All @@ -453,26 +406,14 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct amradio_device *radio = file->private_data;
int retval = -EINVAL;

mutex_lock(&radio->lock);

/* safety check */
if (radio->removed) {
retval = -EIO;
goto unlock;
}

switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
ctrl->value = radio->muted;
retval = 0;
break;
return 0;
}

unlock:
mutex_unlock(&radio->lock);
return retval;
return -EINVAL;
}

/* vidioc_s_ctrl - set the value of a control */
Expand All @@ -482,14 +423,6 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct amradio_device *radio = file->private_data;
int retval = -EINVAL;

mutex_lock(&radio->lock);

/* safety check */
if (radio->removed) {
retval = -EIO;
goto unlock;
}

switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
if (ctrl->value) {
Expand All @@ -508,8 +441,6 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
break;
}

unlock:
mutex_unlock(&radio->lock);
return retval;
}

Expand Down Expand Up @@ -616,6 +547,26 @@ static int usb_amradio_close(struct file *file)
return retval;
}

static long usb_amradio_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct amradio_device *radio = file->private_data;
long retval = 0;

mutex_lock(&radio->lock);

if (radio->removed) {
retval = -EIO;
goto unlock;
}

retval = video_ioctl2(file, cmd, arg);

unlock:
mutex_unlock(&radio->lock);
return retval;
}

/* Suspend device - stop device. Need to be checked and fixed */
static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
{
Expand Down Expand Up @@ -657,7 +608,7 @@ static const struct v4l2_file_operations usb_amradio_fops = {
.owner = THIS_MODULE,
.open = usb_amradio_open,
.release = usb_amradio_close,
.ioctl = video_ioctl2,
.ioctl = usb_amradio_ioctl,
};

static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = {
Expand Down

0 comments on commit b7f1c26

Please sign in to comment.