The patch number 10821 was added via Mauro Carvalho Chehab <mche...@redhat.com> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: Linux Media Mailing List <linux-me...@vger.kernel.org> ------ From: Mauro Carvalho Chehab <mche...@redhat.com> merge: http://linuxtv.org/hg/~tap/v4l-dvb Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com> --- linux/drivers/media/common/saa7146_video.c | 15 linux/drivers/media/video/bt8xx/bttv-driver.c | 19 - linux/drivers/media/video/cx88/cx88-video.c | 8 linux/drivers/media/video/gspca/gspca.c | 4 linux/drivers/media/video/meye.c | 12 linux/drivers/media/video/stk-webcam.c | 6 linux/drivers/media/video/usbvision/usbvision-video.c | 7 linux/drivers/media/video/v4l2-ioctl.c | 168 ++++------ linux/include/media/v4l2-ioctl.h | 1 v4l/scripts/fix_kconfig.pl | 10 10 files changed, 94 insertions(+), 156 deletions(-) diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/common/saa7146_video.c --- a/linux/drivers/media/common/saa7146_video.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/common/saa7146_video.c Wed Mar 04 14:35:16 2009 -0300 @@ -577,11 +577,6 @@ static int vidioc_enum_fmt_vid_cap(struc return 0; } -static int vidioc_enum_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_fmtdesc *f) -{ - return vidioc_enum_fmt_vid_cap(file, fh, f); -} - static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *c) { const struct v4l2_queryctrl *ctrl; @@ -726,12 +721,14 @@ static int vidioc_g_parm(struct file *fi static int vidioc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm) { + struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; + struct saa7146_vv *vv = dev->vv_data; + if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; parm->parm.capture.readbuffers = 1; - /* fixme: only for PAL! */ - parm->parm.capture.timeperframe.numerator = 1; - parm->parm.capture.timeperframe.denominator = 25; + v4l2_video_std_frame_period(vv->standard->id, + &parm->parm.capture.timeperframe); return 0; } @@ -1165,7 +1162,7 @@ const struct v4l2_ioctl_ops saa7146_vide const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { .vidioc_querycap = vidioc_querycap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_overlay, + .vidioc_enum_fmt_vid_overlay = vidioc_enum_fmt_vid_cap, .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/bt8xx/bttv-driver.c --- a/linux/drivers/media/video/bt8xx/bttv-driver.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c Wed Mar 04 14:35:16 2009 -0300 @@ -1922,16 +1922,11 @@ static int bttv_enum_input(struct file * { struct bttv_fh *fh = priv; struct bttv *btv = fh->btv; - unsigned int n; - - n = i->index; - - if (n >= bttv_tvcards[btv->c.type].video_inputs) + int n; + + if (i->index >= bttv_tvcards[btv->c.type].video_inputs) return -EINVAL; - memset(i, 0, sizeof(*i)); - - i->index = n; i->type = V4L2_INPUT_TYPE_CAMERA; i->audioset = 1; @@ -2960,13 +2955,11 @@ static int bttv_g_parm(struct file *file { struct bttv_fh *fh = f; struct bttv *btv = fh->btv; - struct v4l2_standard s; if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - v4l2_video_std_construct(&s, bttv_tvnorms[btv->tvnorm].v4l2_id, - bttv_tvnorms[btv->tvnorm].name); - parm->parm.capture.timeperframe = s.frameperiod; + v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, + &parm->parm.capture.timeperframe); return 0; } @@ -2982,7 +2975,6 @@ static int bttv_g_tuner(struct file *fil return -EINVAL; mutex_lock(&btv->lock); - memset(t, 0, sizeof(*t)); t->rxsubchans = V4L2_TUNER_SUB_MONO; bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t); strcpy(t->name, "Television"); @@ -3525,7 +3517,6 @@ static int radio_g_tuner(struct file *fi if (0 != t->index) return -EINVAL; mutex_lock(&btv->lock); - memset(t, 0, sizeof(*t)); strcpy(t->name, "Radio"); t->type = V4L2_TUNER_RADIO; diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/cx88/cx88-video.c --- a/linux/drivers/media/video/cx88/cx88-video.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/cx88/cx88-video.c Wed Mar 04 14:35:16 2009 -0300 @@ -1514,15 +1514,12 @@ int cx88_enum_input (struct cx88_core * [ CX88_VMUX_DVB ] = "DVB", [ CX88_VMUX_DEBUG ] = "for debug only", }; - unsigned int n; - - n = i->index; + unsigned int n = i->index; + if (n >= 4) return -EINVAL; if (0 == INPUT(n).type) return -EINVAL; - memset(i,0,sizeof(*i)); - i->index = n; i->type = V4L2_INPUT_TYPE_CAMERA; strcpy(i->name,iname[INPUT(n).type]); if ((CX88_VMUX_TELEVISION == INPUT(n).type) || @@ -1787,7 +1784,6 @@ static int radio_g_audio (struct file *f if (unlikely(a->index)) return -EINVAL; - memset(a,0,sizeof(*a)); strcpy(a->name,"Radio"); return 0; } diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/gspca/gspca.c --- a/linux/drivers/media/video/gspca/gspca.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/gspca/gspca.c Wed Mar 04 14:35:16 2009 -0300 @@ -1111,7 +1111,6 @@ static int vidioc_g_audio(struct file *f static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *audio) { - memset(audio, 0, sizeof *audio); strcpy(audio->name, "Microphone"); return 0; } @@ -1145,7 +1144,6 @@ static int vidioc_enum_input(struct file if (input->index != 0) return -EINVAL; - memset(input, 0, sizeof *input); input->type = V4L2_INPUT_TYPE_CAMERA; strncpy(input->name, gspca_dev->sd_desc->name, sizeof input->name); @@ -1353,7 +1351,6 @@ static int vidioc_g_parm(struct file *fi { struct gspca_dev *gspca_dev = priv; - memset(parm, 0, sizeof *parm); parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; parm->parm.capture.readbuffers = gspca_dev->nbufread; @@ -1423,7 +1420,6 @@ static int vidiocgmbuf(struct file *file { struct v4l2_format fmt; - memset(&fmt, 0, sizeof fmt); fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; i = gspca_dev->cam.nmodes - 1; /* highest mode */ fmt.fmt.pix.width = gspca_dev->cam.cam_mode[i].width; diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/meye.c --- a/linux/drivers/media/video/meye.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/meye.c Wed Mar 04 14:35:16 2009 -0300 @@ -1022,7 +1022,6 @@ static int vidioc_querycap(struct file * static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - memset(cap, 0, sizeof(*cap)); strcpy(cap->driver, "meye"); strcpy(cap->card, "meye"); sprintf(cap->bus_info, "PCI:%s", pci_name(meye.mchip_dev)); @@ -1041,8 +1040,6 @@ static int vidioc_enum_input(struct file if (i->index != 0) return -EINVAL; - memset(i, 0, sizeof(*i)); - i->index = 0; strcpy(i->name, "Camera"); i->type = V4L2_INPUT_TYPE_CAMERA; @@ -1269,16 +1266,12 @@ static int vidioc_enum_fmt_vid_cap(struc if (f->index == 0) { /* standard YUV 422 capture */ - memset(f, 0, sizeof(*f)); - f->index = 0; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; f->flags = 0; strcpy(f->description, "YUV422"); f->pixelformat = V4L2_PIX_FMT_YUYV; } else { /* compressed MJPEG capture */ - memset(f, 0, sizeof(*f)); - f->index = 1; f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; f->flags = V4L2_FMT_FLAG_COMPRESSED; strcpy(f->description, "MJPEG"); @@ -1327,9 +1320,6 @@ static int vidioc_g_fmt_vid_cap(struct f if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format)); - f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - switch (meye.mchip_mode) { case MCHIP_HIC_MODE_CONT_OUT: default: @@ -1346,8 +1336,6 @@ static int vidioc_g_fmt_vid_cap(struct f f->fmt.pix.bytesperline = f->fmt.pix.width * 2; f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; - f->fmt.pix.colorspace = 0; - f->fmt.pix.priv = 0; return 0; } diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/stk-webcam.c --- a/linux/drivers/media/video/stk-webcam.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/stk-webcam.c Wed Mar 04 14:35:16 2009 -0300 @@ -934,8 +934,6 @@ static int stk_vidioc_enum_fmt_vid_cap(s static int stk_vidioc_enum_fmt_vid_cap(struct file *filp, void *priv, struct v4l2_fmtdesc *fmtd) { - fmtd->flags = 0; - switch (fmtd->index) { case 0: fmtd->pixelformat = V4L2_PIX_FMT_RGB565; @@ -993,7 +991,6 @@ static int stk_vidioc_g_fmt_vid_cap(stru pix_format->height = stk_sizes[i].h; pix_format->field = V4L2_FIELD_NONE; pix_format->colorspace = V4L2_COLORSPACE_SRGB; - pix_format->priv = 0; pix_format->pixelformat = dev->vsettings.palette; if (dev->vsettings.palette == V4L2_PIX_FMT_SBGGR8) pix_format->bytesperline = pix_format->width; @@ -1247,13 +1244,10 @@ static int stk_vidioc_g_parm(struct file if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - sp->parm.capture.capability = 0; - sp->parm.capture.capturemode = 0; /*FIXME This is not correct */ sp->parm.capture.timeperframe.numerator = 1; sp->parm.capture.timeperframe.denominator = 30; sp->parm.capture.readbuffers = 2; - sp->parm.capture.extendedmode = 0; return 0; } diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/usbvision/usbvision-video.c --- a/linux/drivers/media/video/usbvision/usbvision-video.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/usbvision/usbvision-video.c Wed Mar 04 14:35:16 2009 -0300 @@ -697,7 +697,6 @@ static int vidioc_g_audio (struct file * { struct usb_usbvision *usbvision = video_drvdata(file); - memset(a,0,sizeof(*a)); if(usbvision->radio) { strcpy(a->name,"Radio"); } else { @@ -721,10 +720,6 @@ static int vidioc_queryctrl (struct file struct v4l2_queryctrl *ctrl) { struct usb_usbvision *usbvision = video_drvdata(file); - int id=ctrl->id; - - memset(ctrl,0,sizeof(*ctrl)); - ctrl->id=id; call_all(usbvision, core, queryctrl, ctrl); @@ -926,11 +921,9 @@ static int vidioc_enum_fmt_vid_cap (stru if(vfd->index>=USBVISION_SUPPORTED_PALETTES-1) { return -EINVAL; } - vfd->flags = 0; vfd->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; strcpy(vfd->description,usbvision_v4l2_format[vfd->index].desc); vfd->pixelformat = usbvision_v4l2_format[vfd->index].format; - memset(vfd->reserved, 0, sizeof(vfd->reserved)); return 0; } diff -r 9264bc18af23 -r 4b288a26993d linux/drivers/media/video/v4l2-ioctl.c --- a/linux/drivers/media/video/v4l2-ioctl.c Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/drivers/media/video/v4l2-ioctl.c Wed Mar 04 14:35:16 2009 -0300 @@ -102,25 +102,27 @@ const char *v4l2_norm_to_name(v4l2_std_i } EXPORT_SYMBOL(v4l2_norm_to_name); +/* Returns frame period for the given standard */ +void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod) +{ + if (id & V4L2_STD_525_60) { + frameperiod->numerator = 1001; + frameperiod->denominator = 30000; + } else { + frameperiod->numerator = 1; + frameperiod->denominator = 25; + } +} +EXPORT_SYMBOL(v4l2_video_std_frame_period); + /* Fill in the fields of a v4l2_standard structure according to the 'id' and 'transmission' parameters. Returns negative on error. */ int v4l2_video_std_construct(struct v4l2_standard *vs, int id, const char *name) { - u32 index = vs->index; - - memset(vs, 0, sizeof(struct v4l2_standard)); - vs->index = index; - vs->id = id; - if (id & V4L2_STD_525_60) { - vs->frameperiod.numerator = 1001; - vs->frameperiod.denominator = 30000; - vs->framelines = 525; - } else { - vs->frameperiod.numerator = 1; - vs->frameperiod.denominator = 25; - vs->framelines = 625; - } + vs->id = id; + v4l2_video_std_frame_period(id, &vs->frameperiod); + vs->framelines = (id & V4L2_STD_525_60) ? 525 : 625; strlcpy(vs->name, name, sizeof(vs->name)); return 0; } @@ -656,8 +658,6 @@ static long __video_do_ioctl(struct file if (cmd == VIDIOCGMBUF) { struct video_mbuf *p = arg; - memset(p, 0, sizeof(*p)); - if (!ops->vidiocgmbuf) return ret; ret = ops->vidiocgmbuf(file, fh, p); @@ -684,7 +684,6 @@ static long __video_do_ioctl(struct file case VIDIOC_QUERYCAP: { struct v4l2_capability *cap = (struct v4l2_capability *)arg; - memset(cap, 0, sizeof(*cap)); if (!ops->vidioc_querycap) break; @@ -727,16 +726,8 @@ static long __video_do_ioctl(struct file case VIDIOC_ENUM_FMT: { struct v4l2_fmtdesc *f = arg; - enum v4l2_buf_type type; - unsigned int index; - - index = f->index; - type = f->type; - memset(f, 0, sizeof(*f)); - f->index = index; - f->type = type; - - switch (type) { + + switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (ops->vidioc_enum_fmt_vid_cap) ret = ops->vidioc_enum_fmt_vid_cap(file, fh, f); @@ -772,8 +763,6 @@ static long __video_do_ioctl(struct file case VIDIOC_G_FMT: { struct v4l2_format *f = (struct v4l2_format *)arg; - - 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(f->type, v4l2_type_names)); @@ -969,11 +958,6 @@ static long __video_do_ioctl(struct file ret = check_fmt(ops, p->type); if (ret) break; - - /* Zero out all fields starting with bytesysed, which is - * everything but index and type. */ - memset(0, &p->bytesused, - sizeof(*p) - offsetof(typeof(*p), bytesused)); ret = ops->vidioc_querybuf(file, fh, p); if (!ret) @@ -1095,7 +1079,6 @@ static long __video_do_ioctl(struct file return -EINVAL; v4l2_video_std_construct(p, curr_id, descr); - p->index = index; dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, " "framelines=%d\n", p->index, @@ -1160,12 +1143,9 @@ static long __video_do_ioctl(struct file case VIDIOC_ENUMINPUT: { struct v4l2_input *p = arg; - int i = p->index; if (!ops->vidioc_enum_input) break; - memset(p, 0, sizeof(*p)); - p->index = i; ret = ops->vidioc_enum_input(file, fh, p); if (!ret) @@ -1204,12 +1184,9 @@ static long __video_do_ioctl(struct file case VIDIOC_ENUMOUTPUT: { struct v4l2_output *p = arg; - int i = p->index; if (!ops->vidioc_enum_output) break; - memset(p, 0, sizeof(*p)); - p->index = i; ret = ops->vidioc_enum_output(file, fh, p); if (!ret) @@ -1385,13 +1362,10 @@ static long __video_do_ioctl(struct file case VIDIOC_G_AUDIO: { struct v4l2_audio *p = arg; - __u32 index = p->index; if (!ops->vidioc_g_audio) break; - memset(p, 0, sizeof(*p)); - p->index = index; ret = ops->vidioc_g_audio(file, fh, p); if (!ret) dbgarg(cmd, "index=%d, name=%s, capability=0x%x, " @@ -1433,7 +1407,7 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_g_audout) break; - dbgarg(cmd, "Enum for index=%d\n", p->index); + ret = ops->vidioc_g_audout(file, fh, p); if (!ret) dbgarg2("index=%d, name=%s, capability=%d, " @@ -1486,14 +1460,9 @@ static long __video_do_ioctl(struct file case VIDIOC_G_CROP: { struct v4l2_crop *p = arg; - __u32 type; if (!ops->vidioc_g_crop) break; - - type = p->type; - memset(p, 0, sizeof(*p)); - p->type = type; dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); ret = ops->vidioc_g_crop(file, fh, p); @@ -1515,15 +1484,10 @@ static long __video_do_ioctl(struct file case VIDIOC_CROPCAP: { struct v4l2_cropcap *p = arg; - __u32 type; /*FIXME: Should also show v4l2_fract pixelaspect */ if (!ops->vidioc_cropcap) break; - - type = p->type; - memset(p, 0, sizeof(*p)); - p->type = type; dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); ret = ops->vidioc_cropcap(file, fh, p); @@ -1540,8 +1504,6 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_g_jpegcomp) break; - memset(p, 0, sizeof(*p)); - ret = ops->vidioc_g_jpegcomp(file, fh, p); if (!ret) dbgarg(cmd, "quality=%d, APPn=%d, " @@ -1582,7 +1544,6 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_encoder_cmd) break; - memset(&p->raw, 0, sizeof(p->raw)); ret = ops->vidioc_encoder_cmd(file, fh, p); if (!ret) dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags); @@ -1594,7 +1555,6 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_try_encoder_cmd) break; - memset(&p->raw, 0, sizeof(p->raw)); ret = ops->vidioc_try_encoder_cmd(file, fh, p); if (!ret) dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags); @@ -1603,23 +1563,15 @@ static long __video_do_ioctl(struct file case VIDIOC_G_PARM: { struct v4l2_streamparm *p = arg; - __u32 type = p->type; - - memset(p, 0, sizeof(*p)); - p->type = type; if (ops->vidioc_g_parm) { ret = ops->vidioc_g_parm(file, fh, p); } else { - struct v4l2_standard s; - if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - v4l2_video_std_construct(&s, vfd->current_norm, - v4l2_norm_to_name(vfd->current_norm)); - - p->parm.capture.timeperframe = s.frameperiod; + v4l2_video_std_frame_period(vfd->current_norm, + &p->parm.capture.timeperframe); ret = 0; } @@ -1639,13 +1591,9 @@ static long __video_do_ioctl(struct file case VIDIOC_G_TUNER: { struct v4l2_tuner *p = arg; - __u32 index = p->index; if (!ops->vidioc_g_tuner) break; - - memset(p, 0, sizeof(*p)); - p->index = index; ret = ops->vidioc_g_tuner(file, fh, p); if (!ret) @@ -1683,8 +1631,6 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_g_frequency) break; - memset(p->reserved, 0, sizeof(p->reserved)); - ret = ops->vidioc_g_frequency(file, fh, p); if (!ret) dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", @@ -1705,12 +1651,13 @@ static long __video_do_ioctl(struct file case VIDIOC_G_SLICED_VBI_CAP: { struct v4l2_sliced_vbi_cap *p = arg; - __u32 type = p->type; if (!ops->vidioc_g_sliced_vbi_cap) break; - memset(p, 0, sizeof(*p)); - p->type = type; + + /* Clear up to type, everything after type is zerod already */ + memset(p, 0, offsetof(struct v4l2_sliced_vbi_cap, type)); + dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); ret = ops->vidioc_g_sliced_vbi_cap(file, fh, p); if (!ret) @@ -1782,8 +1729,6 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_enum_framesizes) break; - - memset(p, 0, sizeof(*p)); ret = ops->vidioc_enum_framesizes(file, fh, p); dbgarg(cmd, @@ -1815,8 +1760,6 @@ static long __video_do_ioctl(struct file if (!ops->vidioc_enum_frameintervals) break; - - memset(p, 0, sizeof(*p)); ret = ops->vidioc_enum_frameintervals(file, fh, p); dbgarg(cmd, @@ -1866,6 +1809,44 @@ static long __video_do_ioctl(struct file return ret; } +/* In some cases, only a few fields are used as input, i.e. when the app sets + * "index" and then the driver fills in the rest of the structure for the thing + * with that index. We only need to copy up the first non-input field. */ +static unsigned long cmd_input_size(unsigned int cmd) +{ + /* Size of structure up to and including 'field' */ +#define CMDINSIZE(cmd, type, field) case _IOC_NR(VIDIOC_##cmd): return \ + offsetof(struct v4l2_##type, field) + \ + sizeof(((struct v4l2_##type *)0)->field); + + switch (_IOC_NR(cmd)) { + CMDINSIZE(ENUM_FMT, fmtdesc, type); + CMDINSIZE(G_FMT, format, type); + CMDINSIZE(QUERYBUF, buffer, type); + CMDINSIZE(G_PARM, streamparm, type); + CMDINSIZE(ENUMSTD, standard, index); + CMDINSIZE(ENUMINPUT, input, index); + CMDINSIZE(G_CTRL, control, id); + CMDINSIZE(G_TUNER, tuner, index); + CMDINSIZE(QUERYCTRL, queryctrl, id); + CMDINSIZE(QUERYMENU, querymenu, index); + CMDINSIZE(ENUMOUTPUT, output, index); + CMDINSIZE(G_MODULATOR, modulator, index); + CMDINSIZE(G_FREQUENCY, frequency, tuner); + CMDINSIZE(CROPCAP, cropcap, type); + CMDINSIZE(G_CROP, crop, type); + CMDINSIZE(ENUMAUDIO, audio, index); + CMDINSIZE(ENUMAUDOUT, audioout, index); + CMDINSIZE(ENCODER_CMD, encoder_cmd, flags); + CMDINSIZE(TRY_ENCODER_CMD, encoder_cmd, flags); + CMDINSIZE(G_SLICED_VBI_CAP, sliced_vbi_cap, type); + CMDINSIZE(ENUM_FRAMESIZES, frmsizeenum, pixel_format); + CMDINSIZE(ENUM_FRAMEINTERVALS, frmivalenum, height); + default: + return _IOC_SIZE(cmd); + } +} + long video_ioctl2(struct file *file, unsigned int cmd, unsigned long arg) { @@ -1884,13 +1865,7 @@ long video_ioctl2(struct file *file, cmd == VIDIOC_TRY_EXT_CTRLS); /* Copy arguments into temp kernel buffer */ - switch (_IOC_DIR(cmd)) { - case _IOC_NONE: - parg = NULL; - break; - case _IOC_READ: - case _IOC_WRITE: - case (_IOC_WRITE | _IOC_READ): + if (_IOC_DIR(cmd) != _IOC_NONE) { if (_IOC_SIZE(cmd) <= sizeof(sbuf)) { parg = sbuf; } else { @@ -1902,10 +1877,19 @@ long video_ioctl2(struct file *file, } err = -EFAULT; - if (_IOC_DIR(cmd) & _IOC_WRITE) - if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) + if (_IOC_DIR(cmd) & _IOC_WRITE) { + unsigned long n = cmd_input_size(cmd); + + if (copy_from_user(parg, (void __user *)arg, n)) goto out; - break; + + /* zero out anything we don't copy from userspace */ + if (n < _IOC_SIZE(cmd)) + memset((u8 *)parg + n, 0, _IOC_SIZE(cmd) - n); + } else { + /* read-only ioctl */ + memset(parg, 0, _IOC_SIZE(cmd)); + } } if (is_ext_ctrl) { diff -r 9264bc18af23 -r 4b288a26993d linux/include/media/v4l2-ioctl.h --- a/linux/include/media/v4l2-ioctl.h Wed Mar 04 14:22:49 2009 -0300 +++ b/linux/include/media/v4l2-ioctl.h Wed Mar 04 14:35:16 2009 -0300 @@ -267,6 +267,7 @@ struct v4l2_ioctl_ops { /* Video standard functions */ extern const char *v4l2_norm_to_name(v4l2_std_id id); +extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); extern int v4l2_video_std_construct(struct v4l2_standard *vs, int id, const char *name); /* Prints the ioctl in a human-readable format */ diff -r 9264bc18af23 -r 4b288a26993d v4l/scripts/fix_kconfig.pl --- a/v4l/scripts/fix_kconfig.pl Wed Mar 04 14:22:49 2009 -0300 +++ b/v4l/scripts/fix_kconfig.pl Wed Mar 04 14:35:16 2009 -0300 @@ -4,18 +4,16 @@ my $need_changes = 0; my $need_changes = 0; my $out; -open IN,".config"; +open IN, '<.config'; while (<IN>) { - if (s/CONFIG_VIDEO_CX88_MPEG=y/CONFIG_VIDEO_CX88_MPEG=m/) { - $need_changes=1; - $out .= $_; - } + s/CONFIG_VIDEO_CX88_MPEG=y/CONFIG_VIDEO_CX88_MPEG=m/ and $need_changes=1; + $out .= $_; } close IN; if ($need_changes) { printf("There's a known bug with the building system with this kernel. Working around.\n"); - open OUT, ">.config"; + open OUT, '>.config'; print OUT $out; close OUT; } --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/4b288a26993d8c757a8cd4d8571a3c2572f91934 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits