public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH 1/5] v4l2: add device_caps to struct video_device
Date: Mon, 29 Feb 2016 13:56:58 +0200	[thread overview]
Message-ID: <2212721.ONtxIb5TXV@avalon> (raw)
In-Reply-To: <1532376.RKO5DUDMUz@avalon>

On Monday 29 February 2016 13:56:10 Laurent Pinchart wrote:
> Hi Hans,
> 
> Thank you for the patch.
> 
> On Monday 29 February 2016 12:45:41 Hans Verkuil wrote:
> > From: Hans Verkuil <hans.verkuil@cisco.com>
> > 
> > Instead of letting drivers fill in device_caps at querycap time,
> > let them fill it in when the video device is registered.
> > 
> > This has the advantage that in the future the v4l2 core can access
> > the video device's capabilities and take decisions based on that.
> > 
> > Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> > ---
> > 
> >  drivers/media/v4l2-core/v4l2-ioctl.c | 3 +++
> >  include/media/v4l2-dev.h             | 3 +++
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c
> > b/drivers/media/v4l2-core/v4l2-ioctl.c index 86c4c19..706bb42 100644
> > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > @@ -1020,9 +1020,12 @@ static int v4l_querycap(const struct v4l2_ioctl_ops
> > *ops, struct file *file, void *fh, void *arg)
> > 
> >  {
> >  
> >  	struct v4l2_capability *cap = (struct v4l2_capability *)arg;
> > 
> > +	struct video_device *vfd = video_devdata(file);
> > 
> >  	int ret;
> >  	
> >  	cap->version = LINUX_VERSION_CODE;
> > 
> > +	cap->device_caps = vfd->device_caps;
> > +	cap->capabilities = vfd->device_caps | V4L2_CAP_DEVICE_CAPS;
> > 
> >  	ret = ops->vidioc_querycap(file, fh, cap);
> > 
> > diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
> > index 76056ab..25a3190 100644
> > --- a/include/media/v4l2-dev.h
> > +++ b/include/media/v4l2-dev.h
> > @@ -92,6 +92,9 @@ struct video_device
> > 
> >  	/* device ops */
> >  	const struct v4l2_file_operations *fops;
> > 
> > +	/* device capabilities as used in v4l2_capabilities */
> > +	u32 device_caps;
> 
> How about adding capabilities too (on 64-bit systems we won't lose any space
> as the previous and following fields are 64-bit aligned anyway) ? This
> would allow most, if not all, drivers to drop their vidioc_querycap
> implementation.

It obviously wouldn't as there are other fields to fill. I should wake up 
before sending e-mails.

> >  	/* sysfs */
> >  	struct device dev;		/* v4l device */
> >  	struct cdev *cdev;		/* character device */

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2016-02-29 11:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 11:45 [PATCH 0/5] media: better type handling Hans Verkuil
2016-02-29 11:45 ` [PATCH 1/5] v4l2: add device_caps to struct video_device Hans Verkuil
2016-02-29 11:56   ` Laurent Pinchart
2016-02-29 11:56     ` Laurent Pinchart [this message]
2016-03-01 14:16   ` Laurent Pinchart
2016-02-29 11:45 ` [PATCH 2/5] v4l2-pci-skeleton.c: fill in device_caps in video_device Hans Verkuil
2016-02-29 11:57   ` Laurent Pinchart
2016-02-29 11:45 ` [PATCH 3/5] vivid: set " Hans Verkuil
2016-02-29 11:59   ` Laurent Pinchart
2016-02-29 11:45 ` [PATCH 4/5] media: Add type field to struct media_entity Hans Verkuil
2016-02-29 11:45 ` [PATCH 5/5] media-entity.h: rename _io to _video_device and add real _io Hans Verkuil
2016-02-29 12:23   ` Laurent Pinchart
2016-02-29 12:26     ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2212721.ONtxIb5TXV@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox