V4L/DVB (7946): videodev: small fixes for VIDIOC_G_FREQUENCY and VIDIOC_G_FMT
[pandora-kernel.git] / drivers / media / video / videodev.c
index 7649860..91fd6cb 100644 (file)
@@ -278,6 +278,7 @@ static const char *v4l2_ioctls[] = {
        [_IOC_NR(VIDIOC_DBG_G_REGISTER)]   = "VIDIOC_DBG_G_REGISTER",
 
        [_IOC_NR(VIDIOC_G_CHIP_IDENT)]     = "VIDIOC_G_CHIP_IDENT",
+       [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)]   = "VIDIOC_S_HW_FREQ_SEEK",
 #endif
 };
 #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
@@ -882,16 +883,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
        case VIDIOC_G_FMT:
        {
                struct v4l2_format *f = (struct v4l2_format *)arg;
-               enum v4l2_buf_type type=f->type;
 
-               memset(&f->fmt.pix,0,sizeof(f->fmt.pix));
-               f->type=type;
+               memset(f->fmt.raw_data, 0, sizeof(f->fmt.raw_data));
 
                /* FIXME: Should be one dump per type */
-               dbgarg (cmd, "type=%s\n", prt_names(type,
-                                       v4l2_type_names));
+               dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
 
-               switch (type) {
+               switch (f->type) {
                case V4L2_BUF_TYPE_VIDEO_CAPTURE:
                        if (vfd->vidioc_g_fmt_cap)
                                ret=vfd->vidioc_g_fmt_cap(file, fh, f);
@@ -1687,16 +1685,17 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
        }
        case VIDIOC_G_FREQUENCY:
        {
-               struct v4l2_frequency *p=arg;
+               struct v4l2_frequency *p = arg;
+
                if (!vfd->vidioc_g_frequency)
                        break;
 
-               memset(p,0,sizeof(*p));
+               memset(p->reserved, 0, sizeof(p->reserved));
 
-               ret=vfd->vidioc_g_frequency(file, fh, p);
+               ret = vfd->vidioc_g_frequency(file, fh, p);
                if (!ret)
-                       dbgarg (cmd, "tuner=%d, type=%d, frequency=%d\n",
-                                               p->tuner,p->type,p->frequency);
+                       dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
+                                       p->tuner, p->type, p->frequency);
                break;
        }
        case VIDIOC_S_FREQUENCY:
@@ -1763,6 +1762,17 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
                ret = vfd->vidioc_default(file, fh, cmd, arg);
                break;
        }
+       case VIDIOC_S_HW_FREQ_SEEK:
+       {
+               struct v4l2_hw_freq_seek *p = arg;
+               if (!vfd->vidioc_s_hw_freq_seek)
+                       break;
+               dbgarg(cmd,
+                       "tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n",
+                       p->tuner, p->type, p->seek_upward, p->wrap_around);
+               ret = vfd->vidioc_s_hw_freq_seek(file, fh, p);
+               break;
+       }
        } /* switch */
 
        if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {