From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
linux-media@vger.kernel.org
Subject: Re: [RFC v3 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls
Date: Thu, 16 Jul 2015 11:27:58 +0300 [thread overview]
Message-ID: <1628799.CQBSk2GIHo@avalon> (raw)
In-Reply-To: <55A769E7.8010308@xs4all.nl>
On Thursday 16 July 2015 10:23:03 Hans Verkuil wrote:
> On 07/16/15 10:11, Laurent Pinchart wrote:
> > On Thursday 16 July 2015 09:38:11 Hans Verkuil wrote:
> >> On 07/15/15 23:05, Laurent Pinchart wrote:
> >>> On Friday 12 June 2015 18:46:23 Ricardo Ribalda Delgado wrote:
> >>>> Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
> >>>> use the controller framework.
> >>>>
> >>>> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> >>>> ---
> >>>>
> >>>> drivers/media/usb/uvc/uvc_v4l2.c | 30 ++++++++++++++++++++++++++++++
> >>>> 1 file changed, 30 insertions(+)
> >>>>
> >>>> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c
> >>>> b/drivers/media/usb/uvc/uvc_v4l2.c index 2764f43607c1..e2698a77138a
> >>>> 100644
> >>>> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> >>>> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> >>>> @@ -1001,6 +1001,35 @@ static int uvc_ioctl_g_ext_ctrls(struct file
> >>>> *file, void *fh,
> >>>> return uvc_ctrl_rollback(handle);
> >>>> }
> >>>>
> >>>> +static int uvc_ioctl_g_def_ext_ctrls(struct file *file, void *fh,
> >>>> + struct v4l2_ext_controls *ctrls)
> >>>> +{
> >>>> + struct uvc_fh *handle = fh;
> >>>> + struct uvc_video_chain *chain = handle->chain;
> >>>> + struct v4l2_ext_control *ctrl = ctrls->controls;
> >>>> + unsigned int i;
> >>>> + int ret;
> >>>> + struct v4l2_queryctrl qc;
> >>>> +
> >>>> + ret = uvc_ctrl_begin(chain);
> >>>
> >>> There's no need to call uvc_ctrl_begin() here (and if there was, you'd
> >>> have to call uvc_ctrl_rollback() or uvc_ctrl_commit() before returning).
> >>>
> >>>> + if (ret < 0)
> >>>> + return ret;
> >>>> +
> >>>> + for (i = 0; i < ctrls->count; ++ctrl, ++i) {
> >>>> + qc.id = ctrl->id;
> >>>> + ret = uvc_query_v4l2_ctrl(chain, &qc);
> >>>> + if (ret < 0) {
> >>>> + ctrls->error_idx = i;
> >>>> + return ret;
> >>>> + }
> >>>> + ctrl->value = qc.default_value;
> >>>> + }
> >>>> +
> >>>> + ctrls->error_idx = 0;
> >>>> +
> >>>> + return 0;
> >>>> +}
> >>>
> >>> Instead of open-coding this in multiple drivers, how about adding a
> >>> helper function to the core ? Something like (totally untested)
> >>
> >> It's only open-coded in drivers that do not use the control framework.
> >> For drivers that use the control framework it is completely transparent.
> >
> > Sure, but still, the same function is implemented several times while a
> > single implementation could do. I'd prefer having it in the core until
> > all (or all but one) drivers are converted to the control framework.
>
> There are only three drivers that need to implement this manually: uvc,
> saa7164 and pvrusb2. That's not enough to warrant moving this into the
> core.
I'd argue that even just two drivers would be enough :-) Especially given that
the proposed implementation for uvcvideo is wrong.
> One of these days I should sit down and convert saa7164 to the control
> framework. That shouldn't be too difficult.
How about pvrusb2, is there a good reason not to use the control framework
there ?
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-07-16 8:27 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 16:46 [RFC v3 00/19] New ioct VIDIOC_G_DEF_EXT_CTRLS Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 01/19] media/v4l2-core: Add argument def_value to g_ext_ctrl Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 02/19] media/v4l2-core: add new ioctl VIDIOC_G_DEF_EXT_CTRLS Ricardo Ribalda Delgado
2015-07-17 7:13 ` Sakari Ailus
2015-07-17 7:38 ` Hans Verkuil
2015-07-17 7:44 ` Ricardo Ribalda Delgado
2015-07-20 13:37 ` Hans Verkuil
2015-07-20 13:52 ` Ricardo Ribalda Delgado
2015-07-20 14:31 ` Hans Verkuil
2015-08-10 12:04 ` Ricardo Ribalda Delgado
2015-08-19 13:24 ` Ricardo Ribalda Delgado
2015-08-19 22:19 ` Laurent Pinchart
2015-08-20 12:34 ` Hans Verkuil
2015-06-12 16:46 ` [RFC v3 03/19] videodev2.h: Fix typo in comment Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls Ricardo Ribalda Delgado
2015-07-13 12:10 ` Hans Verkuil
2015-07-15 21:05 ` Laurent Pinchart
2015-07-16 7:38 ` Hans Verkuil
2015-07-16 8:11 ` Laurent Pinchart
2015-07-16 8:23 ` Hans Verkuil
2015-07-16 8:27 ` Laurent Pinchart [this message]
2015-07-16 8:36 ` Hans Verkuil
2015-07-16 8:41 ` Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 05/19] media/pci/saa7164-encoder: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 06/19] media/pci/saa7164-vbi: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 07/19] media/usb/prusb2: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 08/19] v4l2-subdev: Add g_def_ext_ctrls to core_ops Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 09/19] media/i2c/bt819: Implement g_def_ext_ctrls core_op Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 10/19] media/i2c/cs53l32a: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 11/19] media/i2c/cx25840/cx25840-core: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 12/19] media/i2c/msp3400-driver: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 13/19] media/i2c/saa7110: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 14/19] media/i2c/saa7115: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 15/19] media/i2c/tlv320aic23b: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 16/19] media/i2c/vpx3220: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 17/19] media/i2c/wm8775: " Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 18/19] Docbook: media: new ioctl VIDIOC_G_DEF_EXT_CTRLS Ricardo Ribalda Delgado
2015-06-12 16:46 ` [RFC v3 19/19] Documentation: media: Fix code sample Ricardo Ribalda Delgado
2015-06-16 6:09 ` [RFC v3 00/19] New ioct VIDIOC_G_DEF_EXT_CTRLS Hans Verkuil
2015-06-16 8:21 ` Ricardo Ribalda Delgado
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=1628799.CQBSk2GIHo@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=g.liakhovetski@gmx.de \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=ricardo.ribalda@gmail.com \
--cc=sakari.ailus@linux.intel.com \
/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