Re: [PATCH v2 3/4] sta2x11_vip: convert to videobuf2 and control framework

From: Federico Vaga
Date: Sun Sep 23 2012 - 13:16:06 EST


> > +struct sta2x11_vip_fh {
> > + struct v4l2_fh fh;
> > +};
>
> No need to make a sta2x11_vip_fh struct, just use v4l2_fh directly. It
> doesn't add anything. In fact, it's not even used.

Thank you :)


> > static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
> >
> > struct v4l2_format *f)
> >
> > {
> >
> > - struct video_device *dev = priv;
> > - struct sta2x11_vip *vip = video_get_drvdata(dev);
> > + struct sta2x11_vip *vip = video_drvdata(file);
> >
> > int interlace_lim;
> >
> > - if (V4L2_PIX_FMT_UYVY != f->fmt.pix.pixelformat)
> > - return -EINVAL;
> > -
> >
> > if (V4L2_STD_525_60 & vip->std)
> >
> > interlace_lim = 240;
> >
> > else
> >
> > @@ -827,6 +522,8 @@ static int vidioc_try_fmt_vid_cap(struct file
> > *file, void *priv,>
> > return -EINVAL;
>
> No -EINVAL allowed anymore in try_fmt_vid_cap. I generally handle
> unknown field values in try_fmt_vid_cap as if FIELD_ANY was
> specified.

ok, unknown -> any

> >
> > memcpy(&vip->format, &f->fmt.pix, sizeof(struct
v4l2_pix_format));
>
> Just use an assignment: vip->format = f->fmt.pix
>

> >
> > memcpy(&f->fmt.pix, &vip->format, sizeof(struct
v4l2_pix_format));
>
> Assignment
>

Fixed


> > -
> >
> > static const struct v4l2_ioctl_ops vip_ioctl_ops = {
> >
> > .vidioc_querycap = vidioc_querycap,
> >
> > - .vidioc_s_std = vidioc_s_std,
> > + /* FMT handling */
> > + .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
> > + .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
> > + .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
> > + .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap,
> > + /* Buffer handlers */
> > + .vidioc_reqbufs = vb2_ioctl_reqbufs,
> > + .vidioc_querybuf = vb2_ioctl_querybuf,
> > + .vidioc_qbuf = vb2_ioctl_qbuf,
> > + .vidioc_dqbuf = vb2_ioctl_dqbuf,
> > + .vidioc_create_bufs = vb2_ioctl_create_bufs,
>
> If you want to use create_bufs, then in queue_setup() you need to
> handle the fmt argument. See e.g. vivi.c for an example.

Fixed

I will send a patch v3 tomorrow
--
Federico Vaga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/