[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210315173609.1547857-11-ribalda@chromium.org>
Date: Mon, 15 Mar 2021 18:36:08 +0100
From: Ricardo Ribalda <ribalda@...omium.org>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Ricardo Ribalda <ribalda@...omium.org>,
Hans Verkuil <hverkuil@...all.nl>
Subject: [PATCH v4 10/11] media: uvcvideo: Return -EACCES to inactive controls
If a control is inactive return -EACCES to let the userspace know that
the value will not be applied automatically when the control is active
again.
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
Suggested-by: Hans Verkuil <hverkuil@...all.nl>
---
drivers/media/usb/uvc/uvc_ctrl.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index be0fadaf414c..f1593dc2f1ef 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1580,6 +1580,18 @@ int uvc_ctrl_begin(struct uvc_video_chain *chain)
return mutex_lock_interruptible(&chain->ctrl_mutex) ? -ERESTARTSYS : 0;
}
+static bool uvc_ctrl_is_inactive(struct uvc_control *ctrl)
+{
+ struct uvc_control_mapping *map;
+
+ list_for_each_entry(map, &ctrl->info.mappings, list) {
+ if (map->master_id)
+ return true;
+ }
+
+ return false;
+}
+
static int uvc_ctrl_commit_entity(struct uvc_device *dev,
struct uvc_entity *entity, int rollback)
{
@@ -1623,8 +1635,11 @@ static int uvc_ctrl_commit_entity(struct uvc_device *dev,
ctrl->dirty = 0;
- if (ret < 0)
+ if (ret < 0) {
+ if (uvc_ctrl_is_inactive(ctrl))
+ return -EACCES;
return ret;
+ }
}
return 0;
--
2.31.0.rc2.261.g7f71774620-goog
Powered by blists - more mailing lists