public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Helen Koike <helen.koike@collabora.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org, jgebben@codeaurora.org
Subject: Re: [PATCH RFC 1/2] [media] v4l2: add V4L2_INPUT_TYPE_DEFAULT
Date: Fri, 31 Mar 2017 06:42:27 -0300	[thread overview]
Message-ID: <20170331064227.0ecc86e7@vento.lan> (raw)
In-Reply-To: <1c25c87a-506a-d1b1-6d30-129128cd0205@collabora.com>

Em Fri, 31 Mar 2017 00:55:12 -0300
Helen Koike <helen.koike@collabora.com> escreveu:

> On 2017-03-30 11:39 PM, Helen Koike wrote:
> > Hi Laurent,
> >
> > Thanks for reviewing
> >
> > On 2017-03-30 04:56 PM, Laurent Pinchart wrote:  
> >> Hi Helen,
> >>
> >> Thank you for the patch.
> >>
> >> On Thursday 30 Mar 2017 13:02:17 Helen Koike wrote:  
> >>> Add V4L2_INPUT_TYPE_DEFAULT and helpers functions for input ioctls to be
> >>> used when no inputs are available in the device
> >>>
> >>> Signed-off-by: Helen Koike <helen.koike@collabora.com>
> >>> ---
> >>>  drivers/media/v4l2-core/v4l2-ioctl.c | 27 +++++++++++++++++++++++++++
> >>>  include/media/v4l2-ioctl.h           | 26 ++++++++++++++++++++++++++
> >>>  include/uapi/linux/videodev2.h       |  1 +
> >>>  3 files changed, 54 insertions(+)
> >>>
> >>> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c
> >>> b/drivers/media/v4l2-core/v4l2-ioctl.c index 0c3f238..ccaf04b 100644
> >>> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> >>> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> >>> @@ -2573,6 +2573,33 @@ struct mutex *v4l2_ioctl_get_lock(struct
> >>> video_device
> >>> *vdev, unsigned cmd) return vdev->lock;
> >>>  }
> >>>
> >>> +int v4l2_ioctl_enum_input_default(struct file *file, void *priv,
> >>> +                  struct v4l2_input *i)
> >>> +{
> >>> +    if (i->index > 0)
> >>> +        return -EINVAL;
> >>> +
> >>> +    memset(i, 0, sizeof(*i));
> >>> +    i->type = V4L2_INPUT_TYPE_DEFAULT;
> >>> +    strlcpy(i->name, "Default", sizeof(i->name));
> >>> +
> >>> +    return 0;
> >>> +}
> >>> +EXPORT_SYMBOL(v4l2_ioctl_enum_input_default);  
> >>
> >> V4L2 tends to use EXPORT_SYMBOL_GPL.  
> >
> > The whole v4l2-ioctl.c file is using EXPORT_SYMBOL instead of
> > EXPORT_SYMBOL_GPL, should we change it all to EXPORT_SYMBOL_GPL then (in
> > another patch) ?
> >  
> >>
> >> What would you think about calling those default functions directly
> >> from the
> >> core when the input ioctl handlers are not set ? You wouldn't need to
> >> modify
> >> drivers.  
> >
> > Sure, I'll add them in ops inside __video_register_device when it
> > validates the ioctls  
> 
> I just realize I can not simply override struct v4l2_ioctl_ops as it is 
> declared as a const inside strut video_device. I'll call those default 
> functions only when the ioctls are handled to not modify vdev->ops.

You should not override it, anyway. What you should do, instead, is
something like:

static int v4l_ginput(const struct v4l2_ioctl_ops *ops, ...)
{
	if (ops->vidioc_ginput)
		return ops->vidioc_ginput(...);

	/* default code */
}

You should also make sure that the ioctls are alway valid, e. g. by
calling SET_VALID_IOCTL()

Thanks,
Mauro

  reply	other threads:[~2017-03-31  9:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 16:02 [PATCH RFC 1/2] [media] v4l2: add V4L2_INPUT_TYPE_DEFAULT Helen Koike
2017-03-30 16:02 ` [PATCH 2/2] [media] docs-rst: " Helen Koike
2017-03-30 20:26   ` Sakari Ailus
2017-03-31  9:47     ` Mauro Carvalho Chehab
2017-03-30 19:56 ` [PATCH RFC 1/2] [media] v4l2: " Laurent Pinchart
2017-03-31  2:39   ` Helen Koike
2017-03-31  3:55     ` Helen Koike
2017-03-31  9:42       ` Mauro Carvalho Chehab [this message]
2017-03-31  9:51         ` Hans Verkuil
2017-03-31  8:41     ` Laurent Pinchart
2017-03-31  9:33       ` Mauro Carvalho Chehab
2017-03-31  8:29 ` Hans Verkuil
2017-03-31  8:41   ` Laurent Pinchart
2017-03-31  9:08     ` Hans Verkuil
2017-03-31  9:57   ` Mauro Carvalho Chehab
2017-04-03 15:11     ` Helen Koike
2017-04-04 13:22       ` Sakari Ailus
2017-04-07  9:46         ` Hans Verkuil
2017-04-07  9:53           ` Laurent Pinchart
2017-06-06 16:22             ` Helen Koike
2017-06-12  9:26               ` Hans Verkuil
2017-06-30 11:03                 ` Sakari Ailus
2017-06-30 11:13                   ` Hans Verkuil
2017-06-30 13:49                     ` Sakari Ailus
2017-04-07  9:36     ` Hans Verkuil
2017-06-14  4:50 ` [PATCH v2] [media] v4l2: add V4L2_CAP_IO_MC Helen Koike
2017-06-19 11:15   ` Hans Verkuil
2017-06-19 17:49     ` Helen Koike

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=20170331064227.0ecc86e7@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jgebben@codeaurora.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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