]> err.no Git - linux-2.6/blobdiff - drivers/media/video/ivtv/ivtv-ioctl.c
Merge branch 'r8169-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu...
[linux-2.6] / drivers / media / video / ivtv / ivtv-ioctl.c
index 49b297e788dbe3e7b51b7e7179a68e94da5ea835..52e00a7f3110e7835ac2dfea5d674eacc14486b0 100644 (file)
@@ -128,37 +128,6 @@ u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt)
        return set;
 }
 
-static const struct {
-       v4l2_std_id  std;
-       char        *name;
-} enum_stds[] = {
-       { V4L2_STD_PAL_BG | V4L2_STD_PAL_H, "PAL-BGH" },
-       { V4L2_STD_PAL_DK,    "PAL-DK"    },
-       { V4L2_STD_PAL_I,     "PAL-I"     },
-       { V4L2_STD_PAL_M,     "PAL-M"     },
-       { V4L2_STD_PAL_N,     "PAL-N"     },
-       { V4L2_STD_PAL_Nc,    "PAL-Nc"    },
-       { V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H, "SECAM-BGH" },
-       { V4L2_STD_SECAM_DK,  "SECAM-DK"  },
-       { V4L2_STD_SECAM_L,   "SECAM-L"   },
-       { V4L2_STD_SECAM_LC,  "SECAM-L'"  },
-       { V4L2_STD_NTSC_M,    "NTSC-M"    },
-       { V4L2_STD_NTSC_M_JP, "NTSC-J"    },
-       { V4L2_STD_NTSC_M_KR, "NTSC-K"    },
-};
-
-static const struct v4l2_standard ivtv_std_60hz =
-{
-       .frameperiod = {.numerator = 1001, .denominator = 30000},
-       .framelines = 525,
-};
-
-static const struct v4l2_standard ivtv_std_50hz =
-{
-       .frameperiod = {.numerator = 1, .denominator = 25},
-       .framelines = 625,
-};
-
 void ivtv_set_osd_alpha(struct ivtv *itv)
 {
        ivtv_vapi(itv, CX2341X_OSD_SET_GLOBAL_ALPHA, 3,
@@ -345,39 +314,13 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
        return 0;
 }
 
-static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
-{
-       struct v4l2_register *regs = arg;
-       unsigned long flags;
-       volatile u8 __iomem *reg_start;
-
-       if (!capable(CAP_SYS_ADMIN))
-               return -EPERM;
-       if (regs->reg >= IVTV_REG_OFFSET && regs->reg < IVTV_REG_OFFSET + IVTV_REG_SIZE)
-               reg_start = itv->reg_mem - IVTV_REG_OFFSET;
-       else if (itv->has_cx23415 && regs->reg >= IVTV_DECODER_OFFSET &&
-                       regs->reg < IVTV_DECODER_OFFSET + IVTV_DECODER_SIZE)
-               reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
-       else if (regs->reg >= 0 && regs->reg < IVTV_ENCODER_SIZE)
-               reg_start = itv->enc_mem;
-       else
-               return -EINVAL;
-
-       spin_lock_irqsave(&ivtv_cards_lock, flags);
-       if (cmd == VIDIOC_DBG_G_REGISTER) {
-               regs->val = readl(regs->reg + reg_start);
-       } else {
-               writel(regs->val, regs->reg + reg_start);
-       }
-       spin_unlock_irqrestore(&ivtv_cards_lock, flags);
-       return 0;
-}
-
 static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_format *fmt)
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
        struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced;
 
+       vbifmt->reserved[0] = 0;
+       vbifmt->reserved[1] = 0;
        if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
                return -EINVAL;
        vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36;
@@ -396,21 +339,24 @@ static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
 {
        struct ivtv_open_id *id = fh;
        struct ivtv *itv = id->itv;
-
-       fmt->fmt.pix.width = itv->params.width;
-       fmt->fmt.pix.height = itv->params.height;
-       fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
-       fmt->fmt.pix.field = V4L2_FIELD_INTERLACED;
-       if (id->type == IVTV_ENC_STREAM_TYPE_YUV ||
-                       id->type == IVTV_DEC_STREAM_TYPE_YUV) {
-               fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_HM12;
+       struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
+
+       pixfmt->width = itv->params.width;
+       pixfmt->height = itv->params.height;
+       pixfmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
+       pixfmt->field = V4L2_FIELD_INTERLACED;
+       pixfmt->priv = 0;
+       if (id->type == IVTV_ENC_STREAM_TYPE_YUV) {
+               pixfmt->pixelformat = V4L2_PIX_FMT_HM12;
                /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */
-               fmt->fmt.pix.sizeimage =
-                       fmt->fmt.pix.height * fmt->fmt.pix.width +
-                       fmt->fmt.pix.height * (fmt->fmt.pix.width / 2);
+               pixfmt->sizeimage =
+                       pixfmt->height * pixfmt->width +
+                       pixfmt->height * (pixfmt->width / 2);
+               pixfmt->bytesperline = 720;
        } else {
-               fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
-               fmt->fmt.pix.sizeimage = 128 * 1024;
+               pixfmt->pixelformat = V4L2_PIX_FMT_MPEG;
+               pixfmt->sizeimage = 128 * 1024;
+               pixfmt->bytesperline = 0;
        }
        return 0;
 }
@@ -418,14 +364,18 @@ static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
 static int ivtv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt)
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
-
-       fmt->fmt.vbi.sampling_rate = 27000000;
-       fmt->fmt.vbi.offset = 248;
-       fmt->fmt.vbi.samples_per_line = itv->vbi.raw_decoder_line_size - 4;
-       fmt->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
-       fmt->fmt.vbi.start[0] = itv->vbi.start[0];
-       fmt->fmt.vbi.start[1] = itv->vbi.start[1];
-       fmt->fmt.vbi.count[0] = fmt->fmt.vbi.count[1] = itv->vbi.count;
+       struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi;
+
+       vbifmt->sampling_rate = 27000000;
+       vbifmt->offset = 248;
+       vbifmt->samples_per_line = itv->vbi.raw_decoder_line_size - 4;
+       vbifmt->sample_format = V4L2_PIX_FMT_GREY;
+       vbifmt->start[0] = itv->vbi.start[0];
+       vbifmt->start[1] = itv->vbi.start[1];
+       vbifmt->count[0] = vbifmt->count[1] = itv->vbi.count;
+       vbifmt->flags = 0;
+       vbifmt->reserved[0] = 0;
+       vbifmt->reserved[1] = 0;
        return 0;
 }
 
@@ -435,6 +385,8 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo
        struct ivtv_open_id *id = fh;
        struct ivtv *itv = id->itv;
 
+       vbifmt->reserved[0] = 0;
+       vbifmt->reserved[1] = 0;
        vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36;
 
        if (id->type == IVTV_DEC_STREAM_TYPE_VBI) {
@@ -453,42 +405,39 @@ static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f
 {
        struct ivtv_open_id *id = fh;
        struct ivtv *itv = id->itv;
+       struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
 
        if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
                return -EINVAL;
-       fmt->fmt.pix.width = itv->main_rect.width;
-       fmt->fmt.pix.height = itv->main_rect.height;
-       fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
-       fmt->fmt.pix.field = V4L2_FIELD_INTERLACED;
+       pixfmt->width = itv->main_rect.width;
+       pixfmt->height = itv->main_rect.height;
+       pixfmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
+       pixfmt->field = V4L2_FIELD_INTERLACED;
+       pixfmt->priv = 0;
        if (id->type == IVTV_DEC_STREAM_TYPE_YUV) {
                switch (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) {
                case IVTV_YUV_MODE_INTERLACED:
-                       fmt->fmt.pix.field = (itv->yuv_info.lace_mode & IVTV_YUV_SYNC_MASK) ?
+                       pixfmt->field = (itv->yuv_info.lace_mode & IVTV_YUV_SYNC_MASK) ?
                                V4L2_FIELD_INTERLACED_BT : V4L2_FIELD_INTERLACED_TB;
                        break;
                case IVTV_YUV_MODE_PROGRESSIVE:
-                       fmt->fmt.pix.field = V4L2_FIELD_NONE;
+                       pixfmt->field = V4L2_FIELD_NONE;
                        break;
                default:
-                       fmt->fmt.pix.field = V4L2_FIELD_ANY;
+                       pixfmt->field = V4L2_FIELD_ANY;
                        break;
                }
-               fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_HM12;
-               fmt->fmt.pix.bytesperline = 720;
-               fmt->fmt.pix.width = itv->yuv_info.v4l2_src_w;
-               fmt->fmt.pix.height = itv->yuv_info.v4l2_src_h;
-               /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */
-               fmt->fmt.pix.sizeimage =
-                       1080 * ((fmt->fmt.pix.height + 31) & ~31);
-       } else if (id->type == IVTV_ENC_STREAM_TYPE_YUV) {
-               fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_HM12;
+               pixfmt->pixelformat = V4L2_PIX_FMT_HM12;
+               pixfmt->bytesperline = 720;
+               pixfmt->width = itv->yuv_info.v4l2_src_w;
+               pixfmt->height = itv->yuv_info.v4l2_src_h;
                /* YUV size is (Y=(h*w) + UV=(h*(w/2))) */
-               fmt->fmt.pix.sizeimage =
-                       fmt->fmt.pix.height * fmt->fmt.pix.width +
-                       fmt->fmt.pix.height * (fmt->fmt.pix.width / 2);
+               pixfmt->sizeimage =
+                       1080 * ((pixfmt->height + 31) & ~31);
        } else {
-               fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
-               fmt->fmt.pix.sizeimage = 128 * 1024;
+               pixfmt->pixelformat = V4L2_PIX_FMT_MPEG;
+               pixfmt->sizeimage = 128 * 1024;
+               pixfmt->bytesperline = 0;
        }
        return 0;
 }
@@ -496,11 +445,19 @@ static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f
 static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
+       struct v4l2_window *winfmt = &fmt->fmt.win;
 
        if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
                return -EINVAL;
-       fmt->fmt.win.chromakey = itv->osd_chroma_key;
-       fmt->fmt.win.global_alpha = itv->osd_global_alpha;
+       winfmt->chromakey = itv->osd_chroma_key;
+       winfmt->global_alpha = itv->osd_global_alpha;
+       winfmt->field = V4L2_FIELD_INTERLACED;
+       winfmt->clips = NULL;
+       winfmt->clipcount = 0;
+       winfmt->bitmap = NULL;
+       winfmt->w.top = winfmt->w.left = 0;
+       winfmt->w.width = itv->osd_rect.width;
+       winfmt->w.height = itv->osd_rect.height;
        return 0;
 }
 
@@ -542,7 +499,8 @@ static int ivtv_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_
 
        /* set sliced VBI capture format */
        vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36;
-       memset(vbifmt->reserved, 0, sizeof(vbifmt->reserved));
+       vbifmt->reserved[0] = 0;
+       vbifmt->reserved[1] = 0;
 
        if (vbifmt->service_set)
                ivtv_expand_service_set(vbifmt, itv->is_50hz);
@@ -581,9 +539,14 @@ static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format
 static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt)
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
+       u32 chromakey = fmt->fmt.win.chromakey;
+       u8 global_alpha = fmt->fmt.win.global_alpha;
 
        if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT))
                return -EINVAL;
+       ivtv_g_fmt_vid_out_overlay(file, fh, fmt);
+       fmt->fmt.win.chromakey = chromakey;
+       fmt->fmt.win.global_alpha = global_alpha;
        return 0;
 }
 
@@ -612,10 +575,6 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
 
        p->width = w;
        p->height = h;
-       if (w != 720 || h != (itv->is_50hz ? 576 : 480))
-               p->video_temporal_filter = 0;
-       else
-               p->video_temporal_filter = 8;
        if (p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
                fmt->fmt.pix.width /= 2;
        itv->video_dec_func(itv, VIDIOC_S_FMT, fmt);
@@ -728,6 +687,34 @@ static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident
        return -EINVAL;
 }
 
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
+{
+       struct v4l2_register *regs = arg;
+       unsigned long flags;
+       volatile u8 __iomem *reg_start;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+       if (regs->reg >= IVTV_REG_OFFSET && regs->reg < IVTV_REG_OFFSET + IVTV_REG_SIZE)
+               reg_start = itv->reg_mem - IVTV_REG_OFFSET;
+       else if (itv->has_cx23415 && regs->reg >= IVTV_DECODER_OFFSET &&
+                       regs->reg < IVTV_DECODER_OFFSET + IVTV_DECODER_SIZE)
+               reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
+       else if (regs->reg >= 0 && regs->reg < IVTV_ENCODER_SIZE)
+               reg_start = itv->enc_mem;
+       else
+               return -EINVAL;
+
+       spin_lock_irqsave(&ivtv_cards_lock, flags);
+       if (cmd == VIDIOC_DBG_G_REGISTER)
+               regs->val = readl(regs->reg + reg_start);
+       else
+               writel(regs->val, regs->reg + reg_start);
+       spin_unlock_irqrestore(&ivtv_cards_lock, flags);
+       return 0;
+}
+
 static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg)
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
@@ -749,6 +736,7 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_register *re
                return ivtv_i2c_id(itv, reg->match_chip, VIDIOC_DBG_S_REGISTER, reg);
        return ivtv_call_i2c_client(itv, reg->match_chip, VIDIOC_DBG_S_REGISTER, reg);
 }
+#endif
 
 static int ivtv_g_priority(struct file *file, void *fh, enum v4l2_priority *p)
 {
@@ -771,15 +759,11 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
 
-       memset(vcap, 0, sizeof(*vcap));
        strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
        strlcpy(vcap->card, itv->card_name, sizeof(vcap->card));
        strlcpy(vcap->bus_info, pci_name(itv->dev), sizeof(vcap->bus_info));
        vcap->version = IVTV_DRIVER_VERSION;        /* version */
        vcap->capabilities = itv->v4l2_cap;         /* capabilities */
-       /* reserved.. must set to 0! */
-       vcap->reserved[0] = vcap->reserved[1] =
-               vcap->reserved[2] = vcap->reserved[3] = 0;
        return 0;
 }
 
@@ -1177,7 +1161,6 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
        if (vt->index != 0)
                return -EINVAL;
 
-       memset(vt, 0, sizeof(*vt));
        ivtv_call_i2c_clients(itv, VIDIOC_G_TUNER, vt);
 
        if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {
@@ -1196,11 +1179,8 @@ static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
        int set = itv->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525;
        int f, l;
-       enum v4l2_buf_type type = cap->type;
 
-       memset(cap, 0, sizeof(*cap));
-       cap->type = type;
-       if (type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) {
+       if (cap->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) {
                for (f = 0; f < 2; f++) {
                        for (l = 0; l < 24; l++) {
                                if (valid_service_line(f, l, itv->is_50hz))
@@ -1209,7 +1189,7 @@ static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced
                }
                return 0;
        }
-       if (type == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
+       if (cap->type == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
                if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
                        return -EINVAL;
                if (itv->is_60hz) {
@@ -1252,7 +1232,6 @@ static int ivtv_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd
        struct ivtv_open_id *id = fh;
        struct ivtv *itv = id->itv;
 
-       memset(&enc->raw, 0, sizeof(enc->raw));
 
        switch (enc->cmd) {
        case V4L2_ENC_CMD_START:
@@ -1304,8 +1283,6 @@ static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
 
-       memset(&enc->raw, 0, sizeof(enc->raw));
-
        switch (enc->cmd) {
        case V4L2_ENC_CMD_START:
                IVTV_DEBUG_IOCTL("V4L2_ENC_CMD_START\n");
@@ -1358,10 +1335,10 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
                0,
        };
 
-       memset(fb, 0, sizeof(*fb));
-
        if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
                return -EINVAL;
+       if (!itv->osd_video_pbase)
+               return -EINVAL;
 
        fb->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_CHROMAKEY |
                V4L2_FBUF_CAP_GLOBAL_ALPHA;
@@ -1373,7 +1350,19 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
        fb->fmt.pixelformat = pixel_format[pixfmt];
        fb->fmt.width = itv->osd_rect.width;
        fb->fmt.height = itv->osd_rect.height;
+       fb->fmt.field = V4L2_FIELD_INTERLACED;
+       fb->fmt.bytesperline = fb->fmt.width;
+       fb->fmt.colorspace = V4L2_COLORSPACE_SMPTE170M;
+       fb->fmt.field = V4L2_FIELD_INTERLACED;
+       fb->fmt.priv = 0;
+       if (fb->fmt.pixelformat != V4L2_PIX_FMT_PAL8)
+               fb->fmt.bytesperline *= 2;
+       if (fb->fmt.pixelformat == V4L2_PIX_FMT_RGB32 ||
+           fb->fmt.pixelformat == V4L2_PIX_FMT_YUV32)
+               fb->fmt.bytesperline *= 2;
+       fb->fmt.sizeimage = fb->fmt.bytesperline * fb->fmt.height;
        fb->base = (void *)itv->osd_video_pbase;
+       fb->flags = 0;
 
        if (itv->osd_chroma_key_state)
                fb->flags |= V4L2_FBUF_FLAG_CHROMAKEY;
@@ -1414,6 +1403,8 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
 
        if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY))
                return -EINVAL;
+       if (!itv->osd_video_pbase)
+               return -EINVAL;
 
        itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
        itv->osd_local_alpha_state =
@@ -1421,8 +1412,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
        itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
        ivtv_set_osd_alpha(itv);
        yi->track_osd = (fb->flags & V4L2_FBUF_FLAG_OVERLAY) != 0;
-
-       return 0;
+       return ivtv_g_fbuf(file, fh, fb);
 }
 
 static int ivtv_overlay(struct file *file, void *fh, unsigned int on)
@@ -1558,7 +1548,7 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
                        return -EINVAL;
                if (itv->output_mode == OUT_UDMA_YUV && args->y_source == NULL)
                        return 0;
-               if (ivtv_claim_stream(id, id->type)) {
+               if (ivtv_start_decoding(id, id->type)) {
                        return -EBUSY;
                }
                if (ivtv_set_output_mode(itv, OUT_UDMA_YUV) != OUT_UDMA_YUV) {
@@ -1763,6 +1753,7 @@ static int ivtv_default(struct file *file, void *fh, int cmd, void *arg)
 static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct file *filp,
                unsigned int cmd, unsigned long arg)
 {
+       struct video_device *vfd = video_devdata(filp);
        struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data;
        int ret;
 
@@ -1831,13 +1822,11 @@ static int ivtv_serialized_ioctl(struct ivtv *itv, struct inode *inode, struct f
                        return ret;
        }
 
-       if (ivtv_debug & IVTV_DBGFLG_IOCTL) {
-               printk(KERN_INFO "ivtv%d ioctl: ", itv->num);
-               v4l_printk_ioctl(cmd);
-               printk("\n");
-       }
-
-       return video_ioctl2(inode, filp, cmd, arg);
+       if (ivtv_debug & IVTV_DBGFLG_IOCTL)
+               vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG;
+       ret = video_ioctl2(inode, filp, cmd, arg);
+       vfd->debug = 0;
+       return ret;
 }
 
 int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
@@ -1908,13 +1897,13 @@ void ivtv_set_funcs(struct video_device *vdev)
        vdev->vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out;
        vdev->vidioc_g_sliced_vbi_cap       = ivtv_g_sliced_vbi_cap;
        vdev->vidioc_g_chip_ident           = ivtv_g_chip_ident;
+#ifdef CONFIG_VIDEO_ADV_DEBUG
        vdev->vidioc_g_register             = ivtv_g_register;
        vdev->vidioc_s_register             = ivtv_s_register;
+#endif
        vdev->vidioc_default                = ivtv_default;
        vdev->vidioc_queryctrl              = ivtv_queryctrl;
        vdev->vidioc_querymenu              = ivtv_querymenu;
-       vdev->vidioc_g_ctrl                 = ivtv_g_ctrl;
-       vdev->vidioc_s_ctrl                 = ivtv_s_ctrl;
        vdev->vidioc_g_ext_ctrls            = ivtv_g_ext_ctrls;
        vdev->vidioc_s_ext_ctrls            = ivtv_s_ext_ctrls;
        vdev->vidioc_try_ext_ctrls          = ivtv_try_ext_ctrls;