Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=25f30389dd84dcaf54d7d76fdd84e85bec206db6
Commit:     25f30389dd84dcaf54d7d76fdd84e85bec206db6
Parent:     941491f3a52c34506137060716ce73e642ee326e
Author:     Douglas Landgraf <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 19 16:42:25 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Apr 27 15:45:42 2007 -0300

    V4L/DVB (5534): Radio-rtrack2.c Replace rt_ioctl to use video_ioctl2
    
    Convert radio-rtrack2 to use video_ioctl2
    
    Signed-off-by: Douglas Schilling Landgraf <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/radio/radio-rtrack2.c |  221 +++++++++++++++++------------------
 1 files changed, 109 insertions(+), 112 deletions(-)

diff --git a/drivers/media/radio/radio-rtrack2.c 
b/drivers/media/radio/radio-rtrack2.c
index f668387..4239a7f 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -122,6 +122,26 @@ static int rt_setfreq(struct rt_device *dev, unsigned long 
freq)
        return 0;
 }
 
+static int vidioc_querycap(struct file *file, void *priv,
+                               struct v4l2_capability *v)
+{
+       strlcpy(v->driver, "radio-rtrack2", sizeof(v->driver));
+       strlcpy(v->card, "RadioTrack II", sizeof(v->card));
+       sprintf(v->bus_info, "ISA");
+       v->version = RADIO_VERSION;
+       v->capabilities = V4L2_CAP_TUNER;
+       return 0;
+}
+
+static int vidioc_s_tuner(struct file *file, void *priv,
+                               struct v4l2_tuner *v)
+{
+       if (v->index > 0)
+               return -EINVAL;
+
+       return 0;
+}
+
 static int rt_getsigstr(struct rt_device *dev)
 {
        if (inb(io) & 2)        /* bit set = no signal present  */
@@ -129,135 +149,104 @@ static int rt_getsigstr(struct rt_device *dev)
        return 1;               /* signal present               */
 }
 
-static int rt_do_ioctl(struct inode *inode, struct file *file,
-                      unsigned int cmd, void *arg)
+static int vidioc_g_tuner(struct file *file, void *priv,
+                               struct v4l2_tuner *v)
 {
        struct video_device *dev = video_devdata(file);
-       struct rt_device *rt=dev->priv;
+       struct rt_device *rt = dev->priv;
 
-       switch(cmd)
-       {
-               case VIDIOC_QUERYCAP:
-               {
-                       struct v4l2_capability *v = arg;
-                       memset(v,0,sizeof(*v));
-                       strlcpy(v->driver, "radio-rtrack2", sizeof (v->driver));
-                       strlcpy(v->card, "RadioTrack II", sizeof (v->card));
-                       sprintf(v->bus_info,"ISA");
-                       v->version = RADIO_VERSION;
-                       v->capabilities = V4L2_CAP_TUNER;
-
-                       return 0;
-               }
-               case VIDIOC_G_TUNER:
-               {
-                       struct v4l2_tuner *v = arg;
+       if (v->index > 0)
+               return -EINVAL;
 
-                       if (v->index > 0)
-                               return -EINVAL;
+       strcpy(v->name, "FM");
+       v->type = V4L2_TUNER_RADIO;
+       v->rangelow = (88*16000);
+       v->rangehigh = (108*16000);
+       v->rxsubchans = V4L2_TUNER_SUB_MONO;
+       v->capability = V4L2_TUNER_CAP_LOW;
+       v->audmode = V4L2_TUNER_MODE_MONO;
+       v->signal = 0xFFFF*rt_getsigstr(rt);
+       return 0;
+}
 
-                       memset(v,0,sizeof(*v));
-                       strcpy(v->name, "FM");
-                       v->type = V4L2_TUNER_RADIO;
+static int vidioc_s_frequency(struct file *file, void *priv,
+                               struct v4l2_frequency *f)
+{
+       struct video_device *dev = video_devdata(file);
+       struct rt_device *rt = dev->priv;
 
-                       v->rangelow=(88*16000);
-                       v->rangehigh=(108*16000);
-                       v->rxsubchans =V4L2_TUNER_SUB_MONO;
-                       v->capability=V4L2_TUNER_CAP_LOW;
-                       v->audmode = V4L2_TUNER_MODE_MONO;
-                       v->signal=0xFFFF*rt_getsigstr(rt);
+       rt->curfreq = f->frequency;
+       rt_setfreq(rt, rt->curfreq);
+       return 0;
+}
 
-                       return 0;
-               }
-               case VIDIOC_S_TUNER:
-               {
-                       struct v4l2_tuner *v = arg;
+static int vidioc_g_frequency(struct file *file, void *priv,
+                               struct v4l2_frequency *f)
+{
+       struct video_device *dev = video_devdata(file);
+       struct rt_device *rt = dev->priv;
 
-                       if (v->index > 0)
-                               return -EINVAL;
+       f->type = V4L2_TUNER_RADIO;
+       f->frequency = rt->curfreq;
+       return 0;
+}
 
-                       return 0;
-               }
-               case VIDIOC_S_FREQUENCY:
-               {
-                       struct v4l2_frequency *f = arg;
+static int vidioc_queryctrl(struct file *file, void *priv,
+                               struct v4l2_queryctrl *qc)
+{
+       int i;
 
-                       rt->curfreq = f->frequency;
-                       rt_setfreq(rt, rt->curfreq);
+       for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
+               if (qc->id && qc->id == radio_qctrl[i].id) {
+                       memcpy(qc, &(radio_qctrl[i]),
+                                               sizeof(*qc));
                        return 0;
                }
-               case VIDIOC_G_FREQUENCY:
-               {
-                       struct v4l2_frequency *f = arg;
+       }
+       return -EINVAL;
+}
 
-                       f->type = V4L2_TUNER_RADIO;
-                       f->frequency = rt->curfreq;
+static int vidioc_g_ctrl(struct file *file, void *priv,
+                               struct v4l2_control *ctrl)
+{
+       struct video_device *dev = video_devdata(file);
+       struct rt_device *rt = dev->priv;
 
-                       return 0;
-               }
-               case VIDIOC_QUERYCTRL:
-               {
-                       struct v4l2_queryctrl *qc = arg;
-                       int i;
-
-                       for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
-                               if (qc->id && qc->id == radio_qctrl[i].id) {
-                                       memcpy(qc, &(radio_qctrl[i]),
-                                                               sizeof(*qc));
-                                       return (0);
-                               }
-                       }
-                       return -EINVAL;
-               }
-               case VIDIOC_G_CTRL:
-               {
-                       struct v4l2_control *ctrl= arg;
-
-                       switch (ctrl->id) {
-                               case V4L2_CID_AUDIO_MUTE:
-                                       ctrl->value=rt->muted;
-                                       return (0);
-                               case V4L2_CID_AUDIO_VOLUME:
-                                       if (rt->muted)
-                                               ctrl->value=0;
-                                       else
-                                               ctrl->value=65535;
-                                       return (0);
-                       }
-                       return -EINVAL;
-               }
-               case VIDIOC_S_CTRL:
-               {
-                       struct v4l2_control *ctrl= arg;
-
-                       switch (ctrl->id) {
-                               case V4L2_CID_AUDIO_MUTE:
-                                       if (ctrl->value) {
-                                               rt_mute(rt);
-                                       } else {
-                                               rt_unmute(rt);
-                                       }
-                                       return (0);
-                               case V4L2_CID_AUDIO_VOLUME:
-                                       if (ctrl->value) {
-                                               rt_unmute(rt);
-                                       } else {
-                                               rt_mute(rt);
-                                       }
-                                       return (0);
-                       }
-                       return -EINVAL;
-               }
-               default:
-                       return v4l_compat_translate_ioctl(inode,file,cmd,arg,
-                                                         rt_do_ioctl);
+       switch (ctrl->id) {
+       case V4L2_CID_AUDIO_MUTE:
+               ctrl->value = rt->muted;
+               return 0;
+       case V4L2_CID_AUDIO_VOLUME:
+               if (rt->muted)
+                       ctrl->value = 0;
+               else
+                       ctrl->value = 65535;
+               return 0;
        }
+       return -EINVAL;
 }
 
-static int rt_ioctl(struct inode *inode, struct file *file,
-                   unsigned int cmd, unsigned long arg)
+static int vidioc_s_ctrl(struct file *file, void *priv,
+                               struct v4l2_control *ctrl)
 {
-       return video_usercopy(inode, file, cmd, arg, rt_do_ioctl);
+       struct video_device *dev = video_devdata(file);
+       struct rt_device *rt = dev->priv;
+
+       switch (ctrl->id) {
+       case V4L2_CID_AUDIO_MUTE:
+               if (ctrl->value)
+                       rt_mute(rt);
+               else
+                       rt_unmute(rt);
+               return 0;
+       case V4L2_CID_AUDIO_VOLUME:
+               if (ctrl->value)
+                       rt_unmute(rt);
+               else
+                       rt_mute(rt);
+               return 0;
+       }
+       return -EINVAL;
 }
 
 static struct rt_device rtrack2_unit;
@@ -266,7 +255,7 @@ static const struct file_operations rtrack2_fops = {
        .owner          = THIS_MODULE,
        .open           = video_exclusive_open,
        .release        = video_exclusive_release,
-       .ioctl          = rt_ioctl,
+       .ioctl          = video_ioctl2,
        .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
@@ -278,6 +267,14 @@ static struct video_device rtrack2_radio=
        .type           = VID_TYPE_TUNER,
        .hardware       = 0,
        .fops           = &rtrack2_fops,
+       .vidioc_querycap    = vidioc_querycap,
+       .vidioc_g_tuner     = vidioc_g_tuner,
+       .vidioc_s_tuner     = vidioc_s_tuner,
+       .vidioc_g_frequency = vidioc_g_frequency,
+       .vidioc_s_frequency = vidioc_s_frequency,
+       .vidioc_queryctrl   = vidioc_queryctrl,
+       .vidioc_g_ctrl      = vidioc_g_ctrl,
+       .vidioc_s_ctrl      = vidioc_s_ctrl,
 };
 
 static int __init rtrack2_init(void)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to