[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1566564998.3023.13.camel@pengutronix.de>
Date: Fri, 23 Aug 2019 14:56:38 +0200
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Ricardo Ribalda Delgado <ribalda@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Jacopo Mondi <jacopo@...ndi.org>
Subject: Re: [PATCH v3 5/7] media: v4l2-core: Add new helper for area
controls
On Fri, 2019-08-23 at 14:37 +0200, Ricardo Ribalda Delgado wrote:
> Adding a V4L2_CID_UNIT_CELL_SIZE control requires a lot of boilerplate,
> try to minimize it by adding a new helper.
>
> Suggested-by: Philipp Zabel <p.zabel@...gutronix.de>
> Signed-off-by: Ricardo Ribalda Delgado <ribalda@...nel.org>
> ---
> drivers/media/v4l2-core/v4l2-ctrls.c | 25 ++++++++++++++++++++++++-
> include/media/v4l2-ctrls.h | 16 ++++++++++++++++
> 2 files changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index b3bf458df7f7..33e48f0aec1a 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -2660,7 +2660,6 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
> }
> EXPORT_SYMBOL(v4l2_ctrl_new_std_menu_items);
>
> -/* Helper function for standard integer menu controls */
Why move this ...
> struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
> const struct v4l2_ctrl_ops *ops,
> u32 id, u8 _max, u8 _def, const s64 *qmenu_int)
> @@ -2684,6 +2683,30 @@ struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
> }
> EXPORT_SYMBOL(v4l2_ctrl_new_int_menu);
>
> +static void area_init(const struct v4l2_ctrl *ctrl, u32 idx,
> + union v4l2_ctrl_ptr ptr)
> +{
> + memcpy(ptr.p_area, ctrl->priv, sizeof(*ptr.p_area));
> +}
> +
> +static const struct v4l2_ctrl_type_ops area_ops = {
> + .init = area_init,
> +};
> +
> +struct v4l2_ctrl *v4l2_ctrl_new_area(struct v4l2_ctrl_handler *hdl,
> + const struct v4l2_ctrl_ops *ops,
> + u32 id, const struct v4l2_area *area)
> +{
> + static struct v4l2_ctrl_config ctrl = {
> + .id = V4L2_CID_UNIT_CELL_SIZE,
> + .type_ops = &area_ops,
> + };
> +
> + return v4l2_ctrl_new_custom(hdl, &ctrl, (void *)area);
> +}
> +EXPORT_SYMBOL(v4l2_ctrl_new_area);
> +
> +/* Helper function for standard integer menu controls */
... here?
Looks to me like this comment should stay attached to
v4l2_ctrl_new_int_menu.
regards
Philipp
Powered by blists - more mailing lists