All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	Jean-Francois Moine <moinejf@free.fr>,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFCv1 PATCH 1/7] gspca: allow subdrivers to use the control framework.
Date: Sat, 05 May 2012 09:43:01 +0200	[thread overview]
Message-ID: <4FA4DA05.5030001@redhat.com> (raw)
In-Reply-To: <ea7e986dc0fa18da12c22048e9187e9933191d3d.1335625085.git.hans.verkuil@cisco.com>

Hi,

I'm slowly working my way though this series today (both review, as well
as some tweaks and testing).

More comments inline...

On 04/28/2012 05:09 PM, Hans Verkuil wrote:
> From: Hans Verkuil<hans.verkuil@cisco.com>
>
> Make the necessary changes to allow subdrivers to use the control framework.
> This does not add control event support, that needs more work.
>
> Signed-off-by: Hans Verkuil<hans.verkuil@cisco.com>
> ---
>   drivers/media/video/gspca/gspca.c |   13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
> index ca5a2b1..56dff10 100644
> --- a/drivers/media/video/gspca/gspca.c
> +++ b/drivers/media/video/gspca/gspca.c
> @@ -38,6 +38,7 @@
>   #include<linux/uaccess.h>
>   #include<linux/ktime.h>
>   #include<media/v4l2-ioctl.h>
> +#include<media/v4l2-ctrls.h>
>
>   #include "gspca.h"
>
> @@ -1006,6 +1007,8 @@ static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
>
>   	/* set the current control values to their default values
>   	 * which may have changed in sd_init() */
> +	/* does nothing if ctrl_handler == NULL */
> +	v4l2_ctrl_handler_setup(gspca_dev->vdev.ctrl_handler);
>   	ctrl = gspca_dev->cam.ctrls;
>   	if (ctrl != NULL) {
>   		for (i = 0;
> @@ -1323,6 +1326,7 @@ static void gspca_release(struct video_device *vfd)
>   	PDEBUG(D_PROBE, "%s released",
>   		video_device_node_name(&gspca_dev->vdev));
>
> +	v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler);
>   	kfree(gspca_dev->usb_buf);
>   	kfree(gspca_dev);
>   }
> @@ -2347,6 +2351,10 @@ int gspca_dev_probe2(struct usb_interface *intf,
>   	gspca_dev->sd_desc = sd_desc;
>   	gspca_dev->nbufread = 2;
>   	gspca_dev->empty_packet = -1;	/* don't check the empty packets */
> +	gspca_dev->vdev = gspca_template;
> +	gspca_dev->vdev.parent =&intf->dev;
> +	gspca_dev->module = module;
> +	gspca_dev->present = 1;
>
>   	/* configure the subdriver and initialize the USB device */
>   	ret = sd_desc->config(gspca_dev, id);

You also need to move the initialization of the mutexes here, as the
v4l2_ctrl_handler_setup will call s_ctrl on all the controls, and s_ctrl
should take the usb_lock (see my review of the next patch in this series),
I'll make this change myself and merge it into your patch.

> @@ -2368,10 +2376,6 @@ int gspca_dev_probe2(struct usb_interface *intf,
>   	init_waitqueue_head(&gspca_dev->wq);
>
>   	/* init video stuff */
> -	memcpy(&gspca_dev->vdev,&gspca_template, sizeof gspca_template);
> -	gspca_dev->vdev.parent =&intf->dev;
> -	gspca_dev->module = module;
> -	gspca_dev->present = 1;
>   	ret = video_register_device(&gspca_dev->vdev,
>   				  VFL_TYPE_GRABBER,
>   				  -1);
> @@ -2391,6 +2395,7 @@ out:
>   	if (gspca_dev->input_dev)
>   		input_unregister_device(gspca_dev->input_dev);
>   #endif
> +	v4l2_ctrl_handler_free(gspca_dev->vdev.ctrl_handler);
>   	kfree(gspca_dev->usb_buf);
>   	kfree(gspca_dev);
>   	return ret;

Otherwise looks good, I've added it to my local tree (with the
described change), and will include it in my next pullreq.

Regards,

Hans

  parent reply	other threads:[~2012-05-05  7:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28 15:09 [RFCv1 PATCH 0/7] gspca: allow use of control framework and other fixes Hans Verkuil
2012-04-28 15:09 ` [RFCv1 PATCH 1/7] gspca: allow subdrivers to use the control framework Hans Verkuil
2012-04-28 15:09   ` [RFCv1 PATCH 2/7] zc3xx: convert to " Hans Verkuil
2012-05-05 14:35     ` Hans de Goede
2012-04-28 15:09   ` [RFCv1 PATCH 3/7] sn9c20x: " Hans Verkuil
2012-04-28 15:09   ` [RFCv1 PATCH 4/7] gspca: use video_drvdata(file) instead of file->private_data Hans Verkuil
2012-04-28 15:09   ` [RFCv1 PATCH 5/7] gscpa: use v4l2_fh and add G/S_PRIORITY support Hans Verkuil
2012-04-28 15:09   ` [RFCv1 PATCH 6/7] gspca: add support for control events Hans Verkuil
2012-04-28 15:09   ` [RFCv1 PATCH 7/7] gspca: fix querycap and incorrect return codes Hans Verkuil
2012-05-05  7:43   ` Hans de Goede [this message]
2012-05-05  8:34     ` [RFCv1 PATCH 1/7] gspca: allow subdrivers to use the control framework Hans Verkuil
2012-05-05 14:46       ` Hans de Goede
2012-05-05 14:50         ` Hans Verkuil
2012-05-05 14:59           ` Hans de Goede
2012-05-05 17:20             ` Jean-Francois Moine
2012-05-05  9:14     ` Hans Verkuil
2012-05-05 14:44       ` Hans de Goede
2012-05-05 15:02         ` Hans Verkuil
2012-05-05 15:41           ` Hans de Goede
2012-05-05 15:05         ` Hans de Goede
2012-05-05 15:40           ` Hans de Goede
2012-05-05 17:24           ` Jean-Francois Moine
2012-04-30 11:13 ` [RFCv1 PATCH 0/7] gspca: allow use of control framework and other fixes Hans de Goede
2012-05-01 10:28   ` Jean-Francois Moine
2012-05-05  7:38     ` Hans de Goede

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=4FA4DA05.5030001@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=moinejf@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.