* [PATCH 0/2] v4l2-ctrls: various improvements
@ 2020-03-03 11:01 Hans Verkuil
2020-03-03 11:01 ` [PATCH 1/2] v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON Hans Verkuil
2020-03-03 11:02 ` [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound() Hans Verkuil
0 siblings, 2 replies; 5+ messages in thread
From: Hans Verkuil @ 2020-03-03 11:01 UTC (permalink / raw)
To: linux-media; +Cc: Paul Kocialkowski, Ricardo Ribalda Delgado
The first patch improves WARN_ON handling, the second adds a
generic __v4l2_ctrl_s_ctrl_compound function and replaces the
__v4l2_ctrl_s_ctrl_area functions by defines that use the new
__v4l2_ctrl_s_ctrl_compound instead.
Regards,
Hans
Hans Verkuil (2):
v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON
v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()
drivers/media/v4l2-core/v4l2-ctrls.c | 26 +++++++++------
include/media/v4l2-ctrls.h | 49 ++++++++++++++++------------
2 files changed, 45 insertions(+), 30 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON
2020-03-03 11:01 [PATCH 0/2] v4l2-ctrls: various improvements Hans Verkuil
@ 2020-03-03 11:01 ` Hans Verkuil
2020-03-03 11:02 ` [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound() Hans Verkuil
1 sibling, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2020-03-03 11:01 UTC (permalink / raw)
To: linux-media; +Cc: Paul Kocialkowski, Ricardo Ribalda Delgado, Hans Verkuil
If the v4l2_ctrl_g_ctrl*() or __v4l2_ctrl_s_ctrl*() functions
are called for the wrong control type then they call WARN_ON
since that is a driver error. But they still continue, potentially
overwriting data. Change this to return an error (s_ctrl) or 0
(g_ctrl), just to be safe.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/media/v4l2-core/v4l2-ctrls.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 2928c5e0a73d..d3bacf6b59d6 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -3794,7 +3794,8 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl)
struct v4l2_ext_control c;
/* It's a driver bug if this happens. */
- WARN_ON(!ctrl->is_int);
+ if (WARN_ON(!ctrl->is_int))
+ return 0;
c.value = 0;
get_ctrl(ctrl, &c);
return c.value;
@@ -3806,7 +3807,8 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl)
struct v4l2_ext_control c;
/* It's a driver bug if this happens. */
- WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64);
+ if (WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64))
+ return 0;
c.value64 = 0;
get_ctrl(ctrl, &c);
return c.value64;
@@ -4215,7 +4217,8 @@ int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
- WARN_ON(!ctrl->is_int);
+ if (WARN_ON(!ctrl->is_int))
+ return -EINVAL;
ctrl->val = val;
return set_ctrl(NULL, ctrl, 0);
}
@@ -4226,7 +4229,8 @@ int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
- WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64);
+ if (WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64))
+ return -EINVAL;
*ctrl->p_new.p_s64 = val;
return set_ctrl(NULL, ctrl, 0);
}
@@ -4237,7 +4241,8 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
- WARN_ON(ctrl->type != V4L2_CTRL_TYPE_STRING);
+ if (WARN_ON(ctrl->type != V4L2_CTRL_TYPE_STRING))
+ return -EINVAL;
strscpy(ctrl->p_new.p_char, s, ctrl->maximum + 1);
return set_ctrl(NULL, ctrl, 0);
}
@@ -4249,7 +4254,8 @@ int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
- WARN_ON(ctrl->type != V4L2_CTRL_TYPE_AREA);
+ if (WARN_ON(ctrl->type != V4L2_CTRL_TYPE_AREA))
+ return -EINVAL;
*ctrl->p_new.p_area = *area;
return set_ctrl(NULL, ctrl, 0);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()
2020-03-03 11:01 [PATCH 0/2] v4l2-ctrls: various improvements Hans Verkuil
2020-03-03 11:01 ` [PATCH 1/2] v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON Hans Verkuil
@ 2020-03-03 11:02 ` Hans Verkuil
2020-03-04 8:37 ` Ricardo Ribalda Delgado
2020-03-05 14:05 ` Paul Kocialkowski
1 sibling, 2 replies; 5+ messages in thread
From: Hans Verkuil @ 2020-03-03 11:02 UTC (permalink / raw)
To: linux-media; +Cc: Paul Kocialkowski, Ricardo Ribalda Delgado, Hans Verkuil
Rather than creating new compound control helpers for each new
type, create one generic function and just create defines on
top.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/media/v4l2-core/v4l2-ctrls.c | 10 +++---
include/media/v4l2-ctrls.h | 49 ++++++++++++++++------------
2 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index d3bacf6b59d6..68684fcbdc61 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -4248,18 +4248,18 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
}
EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_string);
-int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
- const struct v4l2_area *area)
+int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
+ enum v4l2_ctrl_type type, const void *p)
{
lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
- if (WARN_ON(ctrl->type != V4L2_CTRL_TYPE_AREA))
+ if (WARN_ON(ctrl->type != type))
return -EINVAL;
- *ctrl->p_new.p_area = *area;
+ memcpy(ctrl->p_new.p, p, ctrl->elems * ctrl->elem_size);
return set_ctrl(NULL, ctrl, 0);
}
-EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_area);
+EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_compound);
void v4l2_ctrl_request_complete(struct media_request *req,
struct v4l2_ctrl_handler *main_hdl)
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 7db9e719a583..75a8daacb4c4 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -1113,45 +1113,54 @@ static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
}
/**
- * __v4l2_ctrl_s_ctrl_area() - Unlocked variant of v4l2_ctrl_s_ctrl_area().
+ * __v4l2_ctrl_s_ctrl_compound() - Unlocked variant to set a compound control
*
- * @ctrl: The control.
- * @area: The new area.
+ * @ctrl: The control.
+ * @type: The type of the data.
+ * @p: The new compound payload.
*
- * This sets the control's new area safely by going through the control
- * framework. This function assumes the control's handler is already locked,
- * allowing it to be used from within the &v4l2_ctrl_ops functions.
+ * This sets the control's new compound payload safely by going through the
+ * control framework. This function assumes the control's handler is already
+ * locked, allowing it to be used from within the &v4l2_ctrl_ops functions.
*
- * This function is for area type controls only.
+ * This function is for compound type controls only.
*/
-int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
- const struct v4l2_area *area);
+int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
+ enum v4l2_ctrl_type type, const void *p);
/**
- * v4l2_ctrl_s_ctrl_area() - Helper function to set a control's area value
- * from within a driver.
+ * v4l2_ctrl_s_ctrl_compound() - Helper function to set a compound control
+ * from within a driver.
*
- * @ctrl: The control.
- * @area: The new area.
+ * @ctrl: The control.
+ * @type: The type of the data.
+ * @p: The new compound payload.
*
- * This sets the control's new area safely by going through the control
- * framework. This function will lock the control's handler, so it cannot be
- * used from within the &v4l2_ctrl_ops functions.
+ * This sets the control's new compound payload safely by going through the
+ * control framework. This function will lock the control's handler, so it
+ * cannot be used from within the &v4l2_ctrl_ops functions.
*
- * This function is for area type controls only.
+ * This function is for compound type controls only.
*/
-static inline int v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
- const struct v4l2_area *area)
+static inline int v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
+ enum v4l2_ctrl_type type,
+ const void *p)
{
int rval;
v4l2_ctrl_lock(ctrl);
- rval = __v4l2_ctrl_s_ctrl_area(ctrl, area);
+ rval = __v4l2_ctrl_s_ctrl_compound(ctrl, type, p);
v4l2_ctrl_unlock(ctrl);
return rval;
}
+/* Helper defines for area type controls */
+#define __v4l2_ctrl_s_ctrl_area(ctrl, area) \
+ __v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
+#define v4l2_ctrl_s_ctrl_area(ctrl, area) \
+ v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
+
/* Internal helper functions that deal with control events. */
extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()
2020-03-03 11:02 ` [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound() Hans Verkuil
@ 2020-03-04 8:37 ` Ricardo Ribalda Delgado
2020-03-05 14:05 ` Paul Kocialkowski
1 sibling, 0 replies; 5+ messages in thread
From: Ricardo Ribalda Delgado @ 2020-03-04 8:37 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Paul Kocialkowski
HI Hans
I have just come back from holidays. If you give me a week I can test
it in real hardware.
Thanks!
On Tue, Mar 3, 2020 at 12:03 PM Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote:
>
> Rather than creating new compound control helpers for each new
> type, create one generic function and just create defines on
> top.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> drivers/media/v4l2-core/v4l2-ctrls.c | 10 +++---
> include/media/v4l2-ctrls.h | 49 ++++++++++++++++------------
> 2 files changed, 34 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index d3bacf6b59d6..68684fcbdc61 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -4248,18 +4248,18 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
> }
> EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_string);
>
> -int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
> - const struct v4l2_area *area)
> +int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
> + enum v4l2_ctrl_type type, const void *p)
> {
> lockdep_assert_held(ctrl->handler->lock);
>
> /* It's a driver bug if this happens. */
> - if (WARN_ON(ctrl->type != V4L2_CTRL_TYPE_AREA))
> + if (WARN_ON(ctrl->type != type))
> return -EINVAL;
> - *ctrl->p_new.p_area = *area;
> + memcpy(ctrl->p_new.p, p, ctrl->elems * ctrl->elem_size);
> return set_ctrl(NULL, ctrl, 0);
> }
> -EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_area);
> +EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_compound);
>
> void v4l2_ctrl_request_complete(struct media_request *req,
> struct v4l2_ctrl_handler *main_hdl)
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index 7db9e719a583..75a8daacb4c4 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -1113,45 +1113,54 @@ static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
> }
>
> /**
> - * __v4l2_ctrl_s_ctrl_area() - Unlocked variant of v4l2_ctrl_s_ctrl_area().
> + * __v4l2_ctrl_s_ctrl_compound() - Unlocked variant to set a compound control
> *
> - * @ctrl: The control.
> - * @area: The new area.
> + * @ctrl: The control.
> + * @type: The type of the data.
> + * @p: The new compound payload.
> *
> - * This sets the control's new area safely by going through the control
> - * framework. This function assumes the control's handler is already locked,
> - * allowing it to be used from within the &v4l2_ctrl_ops functions.
> + * This sets the control's new compound payload safely by going through the
> + * control framework. This function assumes the control's handler is already
> + * locked, allowing it to be used from within the &v4l2_ctrl_ops functions.
> *
> - * This function is for area type controls only.
> + * This function is for compound type controls only.
> */
> -int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
> - const struct v4l2_area *area);
> +int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
> + enum v4l2_ctrl_type type, const void *p);
>
> /**
> - * v4l2_ctrl_s_ctrl_area() - Helper function to set a control's area value
> - * from within a driver.
> + * v4l2_ctrl_s_ctrl_compound() - Helper function to set a compound control
> + * from within a driver.
> *
> - * @ctrl: The control.
> - * @area: The new area.
> + * @ctrl: The control.
> + * @type: The type of the data.
> + * @p: The new compound payload.
> *
> - * This sets the control's new area safely by going through the control
> - * framework. This function will lock the control's handler, so it cannot be
> - * used from within the &v4l2_ctrl_ops functions.
> + * This sets the control's new compound payload safely by going through the
> + * control framework. This function will lock the control's handler, so it
> + * cannot be used from within the &v4l2_ctrl_ops functions.
> *
> - * This function is for area type controls only.
> + * This function is for compound type controls only.
> */
> -static inline int v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
> - const struct v4l2_area *area)
> +static inline int v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
> + enum v4l2_ctrl_type type,
> + const void *p)
> {
> int rval;
>
> v4l2_ctrl_lock(ctrl);
> - rval = __v4l2_ctrl_s_ctrl_area(ctrl, area);
> + rval = __v4l2_ctrl_s_ctrl_compound(ctrl, type, p);
> v4l2_ctrl_unlock(ctrl);
>
> return rval;
> }
>
> +/* Helper defines for area type controls */
> +#define __v4l2_ctrl_s_ctrl_area(ctrl, area) \
> + __v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
> +#define v4l2_ctrl_s_ctrl_area(ctrl, area) \
> + v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
> +
> /* Internal helper functions that deal with control events. */
> extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound()
2020-03-03 11:02 ` [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound() Hans Verkuil
2020-03-04 8:37 ` Ricardo Ribalda Delgado
@ 2020-03-05 14:05 ` Paul Kocialkowski
1 sibling, 0 replies; 5+ messages in thread
From: Paul Kocialkowski @ 2020-03-05 14:05 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Ricardo Ribalda Delgado
[-- Attachment #1: Type: text/plain, Size: 5149 bytes --]
Hi Hans,
On Tue 03 Mar 20, 12:02, Hans Verkuil wrote:
> Rather than creating new compound control helpers for each new
> type, create one generic function and just create defines on
> top.
Thanks for the patch, works fine here!
Tested-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Cheers,
Paul
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> drivers/media/v4l2-core/v4l2-ctrls.c | 10 +++---
> include/media/v4l2-ctrls.h | 49 ++++++++++++++++------------
> 2 files changed, 34 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index d3bacf6b59d6..68684fcbdc61 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -4248,18 +4248,18 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
> }
> EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_string);
>
> -int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
> - const struct v4l2_area *area)
> +int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
> + enum v4l2_ctrl_type type, const void *p)
> {
> lockdep_assert_held(ctrl->handler->lock);
>
> /* It's a driver bug if this happens. */
> - if (WARN_ON(ctrl->type != V4L2_CTRL_TYPE_AREA))
> + if (WARN_ON(ctrl->type != type))
> return -EINVAL;
> - *ctrl->p_new.p_area = *area;
> + memcpy(ctrl->p_new.p, p, ctrl->elems * ctrl->elem_size);
> return set_ctrl(NULL, ctrl, 0);
> }
> -EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_area);
> +EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_compound);
>
> void v4l2_ctrl_request_complete(struct media_request *req,
> struct v4l2_ctrl_handler *main_hdl)
> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> index 7db9e719a583..75a8daacb4c4 100644
> --- a/include/media/v4l2-ctrls.h
> +++ b/include/media/v4l2-ctrls.h
> @@ -1113,45 +1113,54 @@ static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
> }
>
> /**
> - * __v4l2_ctrl_s_ctrl_area() - Unlocked variant of v4l2_ctrl_s_ctrl_area().
> + * __v4l2_ctrl_s_ctrl_compound() - Unlocked variant to set a compound control
> *
> - * @ctrl: The control.
> - * @area: The new area.
> + * @ctrl: The control.
> + * @type: The type of the data.
> + * @p: The new compound payload.
> *
> - * This sets the control's new area safely by going through the control
> - * framework. This function assumes the control's handler is already locked,
> - * allowing it to be used from within the &v4l2_ctrl_ops functions.
> + * This sets the control's new compound payload safely by going through the
> + * control framework. This function assumes the control's handler is already
> + * locked, allowing it to be used from within the &v4l2_ctrl_ops functions.
> *
> - * This function is for area type controls only.
> + * This function is for compound type controls only.
> */
> -int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
> - const struct v4l2_area *area);
> +int __v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
> + enum v4l2_ctrl_type type, const void *p);
>
> /**
> - * v4l2_ctrl_s_ctrl_area() - Helper function to set a control's area value
> - * from within a driver.
> + * v4l2_ctrl_s_ctrl_compound() - Helper function to set a compound control
> + * from within a driver.
> *
> - * @ctrl: The control.
> - * @area: The new area.
> + * @ctrl: The control.
> + * @type: The type of the data.
> + * @p: The new compound payload.
> *
> - * This sets the control's new area safely by going through the control
> - * framework. This function will lock the control's handler, so it cannot be
> - * used from within the &v4l2_ctrl_ops functions.
> + * This sets the control's new compound payload safely by going through the
> + * control framework. This function will lock the control's handler, so it
> + * cannot be used from within the &v4l2_ctrl_ops functions.
> *
> - * This function is for area type controls only.
> + * This function is for compound type controls only.
> */
> -static inline int v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
> - const struct v4l2_area *area)
> +static inline int v4l2_ctrl_s_ctrl_compound(struct v4l2_ctrl *ctrl,
> + enum v4l2_ctrl_type type,
> + const void *p)
> {
> int rval;
>
> v4l2_ctrl_lock(ctrl);
> - rval = __v4l2_ctrl_s_ctrl_area(ctrl, area);
> + rval = __v4l2_ctrl_s_ctrl_compound(ctrl, type, p);
> v4l2_ctrl_unlock(ctrl);
>
> return rval;
> }
>
> +/* Helper defines for area type controls */
> +#define __v4l2_ctrl_s_ctrl_area(ctrl, area) \
> + __v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
> +#define v4l2_ctrl_s_ctrl_area(ctrl, area) \
> + v4l2_ctrl_s_ctrl_compound((ctrl), V4L2_CTRL_TYPE_AREA, (area))
> +
> /* Internal helper functions that deal with control events. */
> extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
>
> --
> 2.25.1
>
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-05 14:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 11:01 [PATCH 0/2] v4l2-ctrls: various improvements Hans Verkuil
2020-03-03 11:01 ` [PATCH 1/2] v4l2-ctrls: v4l2_ctrl_g/s_ctrl*(): don't continue when WARN_ON Hans Verkuil
2020-03-03 11:02 ` [PATCH 2/2] v4l2-ctrls: add __v4l2_ctrl_s_ctrl_compound() Hans Verkuil
2020-03-04 8:37 ` Ricardo Ribalda Delgado
2020-03-05 14:05 ` Paul Kocialkowski
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.