Hi Guennadi,

On Tuesday, 5 December 2017 11:14:18 EET Guennadi Liakhovetski wrote:
> On Tue, 5 Dec 2017, Laurent Pinchart wrote:
> > The function will then be used to register the video device for metadata
> > capture.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> > ---
> > 
> >  drivers/media/usb/uvc/uvc_driver.c | 66 ++++++++++++++++++++-------------
> >  drivers/media/usb/uvc/uvcvideo.h   |  8 +++++
> >  2 files changed, 49 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c
> > b/drivers/media/usb/uvc/uvc_driver.c index f77e31fcfc57..b832929d3382
> > 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -24,6 +24,7 @@
> >  #include <asm/unaligned.h>
> >  
> >  #include <media/v4l2-common.h>
> > +#include <media/v4l2-ioctl.h>
> > 
> >  #include "uvcvideo.h"
> > @@ -1895,52 +1896,63 @@ static void uvc_unregister_video(struct uvc_device
> > *dev)
> 
> [snip]
> 
> >     vdev->release = uvc_release;
> >     vdev->prio = &stream->chain->prio;
> > 
> > -   if (stream->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
> > +   if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
> >             vdev->vfl_dir = VFL_DIR_TX;
> 
> Why isn't .vfl_dir set for other stream types? Are you jusut relying on
> VFL_DIR_RX == 0? I'd use a switch (type) here which then would be extended
> in your next patch with .device_caps fields.

Yes, and I agree it's not right. How about

        if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
                vdev->vfl_dir = VFL_DIR_TX;
        else
                vdev->vfl_dir = VFL_DIR_RX;

Then it won't need to be touched when adding metadata support.

-- 
Regards,

Laurent Pinchart

Reply via email to