Re: [PATCH 06/10] uvcvideo: Refactor uvc_ctrl_get and query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

Thanks for the patch.

On Sunday 25 March 2012 13:56:46 Hans de Goede wrote:
> This is a preparation patch for adding ctrl event support.
> 
> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
> ---
>  drivers/media/video/uvc/uvc_ctrl.c |   69
> ++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 23
> deletions(-)
> 
> diff --git a/drivers/media/video/uvc/uvc_ctrl.c
> b/drivers/media/video/uvc/uvc_ctrl.c index 0efd3b1..4002b5b 100644
> --- a/drivers/media/video/uvc/uvc_ctrl.c
> +++ b/drivers/media/video/uvc/uvc_ctrl.c
> @@ -899,24 +899,14 @@ static int uvc_ctrl_populate_cache(struct
> uvc_video_chain *chain, return 0;
>  }
> 
> -int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
> +static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
> +	struct uvc_control *ctrl,
> +	struct uvc_control_mapping *mapping,
>  	struct v4l2_queryctrl *v4l2_ctrl)
>  {
> -	struct uvc_control *ctrl;
> -	struct uvc_control_mapping *mapping;
>  	struct uvc_menu_info *menu;
>  	unsigned int i;
> -	int ret;
> -
> -	ret = mutex_lock_interruptible(&chain->ctrl_mutex);
> -	if (ret < 0)
> -		return -ERESTARTSYS;
> -

Now that this function doesn't lock a mutex, you can replace the goto done 
statements with return ret (patch 09/10 adds a goto done that will need to be 
replaced as well). With this change,

Acked-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

> -	ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);
> -	if (ctrl == NULL) {
> -		ret = -EINVAL;
> -		goto done;
> -	}
> +	int ret = 0;
> 
>  	memset(v4l2_ctrl, 0, sizeof *v4l2_ctrl);
>  	v4l2_ctrl->id = mapping->id;
> @@ -985,6 +975,28 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
>  				  uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
> 
>  done:
> +	return ret;
> +}

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux