diff mbox series

[v9,05/22] media: uvcvideo: Remove s_ctrl and g_ctrl

Message ID 20210326095840.364424-6-ribalda@chromium.org
State Accepted
Commit 0c6bcbdfefa83b8a1e9659b3c127758dce0fe7ac
Headers show
Series uvcvideo: Fix v4l2-compliance errors | expand

Commit Message

Ricardo Ribalda March 26, 2021, 9:58 a.m. UTC
If we do not implement these callbacks the framework will call the
ext_ctrl callbaks instead, which are a superset of this functions.

Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/usb/uvc/uvc_v4l2.c | 56 --------------------------------
 1 file changed, 56 deletions(-)

Comments

Laurent Pinchart June 10, 2021, 4:24 p.m. UTC | #1
Hi Ricardo,

Thank you for the patch.

On Fri, Mar 26, 2021 at 10:58:23AM +0100, Ricardo Ribalda wrote:
> If we do not implement these callbacks the framework will call the

> ext_ctrl callbaks instead, which are a superset of this functions.

> 

> Suggested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

> ---

>  drivers/media/usb/uvc/uvc_v4l2.c | 56 --------------------------------

>  1 file changed, 56 deletions(-)


Nice diffstat.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


> 

> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c

> index 47b0e3224205..ac98869d5a05 100644

> --- a/drivers/media/usb/uvc/uvc_v4l2.c

> +++ b/drivers/media/usb/uvc/uvc_v4l2.c

> @@ -983,60 +983,6 @@ static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,

>  	return 0;

>  }

>  

> -static int uvc_ioctl_g_ctrl(struct file *file, void *fh,

> -			    struct v4l2_control *ctrl)

> -{

> -	struct uvc_fh *handle = fh;

> -	struct uvc_video_chain *chain = handle->chain;

> -	struct v4l2_ext_control xctrl;

> -	int ret;

> -

> -	memset(&xctrl, 0, sizeof(xctrl));

> -	xctrl.id = ctrl->id;

> -

> -	ret = uvc_ctrl_begin(chain);

> -	if (ret < 0)

> -		return ret;

> -

> -	ret = uvc_ctrl_get(chain, &xctrl);

> -	uvc_ctrl_rollback(handle);

> -	if (ret < 0)

> -		return ret;

> -

> -	ctrl->value = xctrl.value;

> -	return 0;

> -}

> -

> -static int uvc_ioctl_s_ctrl(struct file *file, void *fh,

> -			    struct v4l2_control *ctrl)

> -{

> -	struct uvc_fh *handle = fh;

> -	struct uvc_video_chain *chain = handle->chain;

> -	struct v4l2_ext_control xctrl;

> -	int ret;

> -

> -	memset(&xctrl, 0, sizeof(xctrl));

> -	xctrl.id = ctrl->id;

> -	xctrl.value = ctrl->value;

> -

> -	ret = uvc_ctrl_begin(chain);

> -	if (ret < 0)

> -		return ret;

> -

> -	ret = uvc_ctrl_set(handle, &xctrl);

> -	if (ret < 0) {

> -		uvc_ctrl_rollback(handle);

> -		return ret;

> -	}

> -

> -	ret = uvc_ctrl_commit(handle, &xctrl, 1);

> -	if (ret < 0)

> -		return ret;

> -

> -	ctrl->value = xctrl.value;

> -	return 0;

> -}

> -

>  static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,

>  				 struct v4l2_ext_controls *ctrls)

>  {

> @@ -1522,8 +1468,6 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {

>  	.vidioc_s_input = uvc_ioctl_s_input,

>  	.vidioc_queryctrl = uvc_ioctl_queryctrl,

>  	.vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl,

> -	.vidioc_g_ctrl = uvc_ioctl_g_ctrl,

> -	.vidioc_s_ctrl = uvc_ioctl_s_ctrl,

>  	.vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,

>  	.vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,

>  	.vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls,


-- 
Regards,

Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 47b0e3224205..ac98869d5a05 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -983,60 +983,6 @@  static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,
 	return 0;
 }
 
-static int uvc_ioctl_g_ctrl(struct file *file, void *fh,
-			    struct v4l2_control *ctrl)
-{
-	struct uvc_fh *handle = fh;
-	struct uvc_video_chain *chain = handle->chain;
-	struct v4l2_ext_control xctrl;
-	int ret;
-
-	memset(&xctrl, 0, sizeof(xctrl));
-	xctrl.id = ctrl->id;
-
-	ret = uvc_ctrl_begin(chain);
-	if (ret < 0)
-		return ret;
-
-	ret = uvc_ctrl_get(chain, &xctrl);
-	uvc_ctrl_rollback(handle);
-	if (ret < 0)
-		return ret;
-
-	ctrl->value = xctrl.value;
-	return 0;
-}
-
-static int uvc_ioctl_s_ctrl(struct file *file, void *fh,
-			    struct v4l2_control *ctrl)
-{
-	struct uvc_fh *handle = fh;
-	struct uvc_video_chain *chain = handle->chain;
-	struct v4l2_ext_control xctrl;
-	int ret;
-
-	memset(&xctrl, 0, sizeof(xctrl));
-	xctrl.id = ctrl->id;
-	xctrl.value = ctrl->value;
-
-	ret = uvc_ctrl_begin(chain);
-	if (ret < 0)
-		return ret;
-
-	ret = uvc_ctrl_set(handle, &xctrl);
-	if (ret < 0) {
-		uvc_ctrl_rollback(handle);
-		return ret;
-	}
-
-	ret = uvc_ctrl_commit(handle, &xctrl, 1);
-	if (ret < 0)
-		return ret;
-
-	ctrl->value = xctrl.value;
-	return 0;
-}
-
 static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
 				 struct v4l2_ext_controls *ctrls)
 {
@@ -1522,8 +1468,6 @@  const struct v4l2_ioctl_ops uvc_ioctl_ops = {
 	.vidioc_s_input = uvc_ioctl_s_input,
 	.vidioc_queryctrl = uvc_ioctl_queryctrl,
 	.vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl,
-	.vidioc_g_ctrl = uvc_ioctl_g_ctrl,
-	.vidioc_s_ctrl = uvc_ioctl_s_ctrl,
 	.vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
 	.vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,
 	.vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls,