[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190826075457.n2doitmfswywrpy6@uno.localdomain>
Date: Mon, 26 Aug 2019 09:54:57 +0200
From: Jacopo Mondi <jacopo@...ndi.org>
To: Ricardo Ribalda Delgado <ribalda@...nel.org>
Cc: Philipp Zabel <p.zabel@...gutronix.de>,
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
Subject: Re: [PATCH v3 7/7] imx214: Use v4l2_ctrl_new_area helper
Hi Ricardo,
On Fri, Aug 23, 2019 at 02:37:37PM +0200, Ricardo Ribalda Delgado wrote:
> Instead of creating manually the V4L2_CID_UNIT_CELL_SIZE control, lets
> use the helper.
>
I think you should drop 4/7 and use directly the new helper here.
Thanks
j
> Signed-off-by: Ricardo Ribalda Delgado <ribalda@...nel.org>
> ---
> drivers/media/i2c/imx214.c | 29 ++++++++---------------------
> 1 file changed, 8 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index cc0a013ba7da..625617d4c81a 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -942,26 +942,6 @@ static int __maybe_unused imx214_resume(struct device *dev)
> return ret;
> }
>
> -static void unit_size_init(const struct v4l2_ctrl *ctrl, u32 idx,
> - union v4l2_ctrl_ptr ptr)
> -{
> - ptr.p_area->width = 1120;
> - ptr.p_area->height = 1120;
> -}
> -
> -static const struct v4l2_ctrl_type_ops unit_size_ops = {
> - .init = unit_size_init,
> -};
> -
> -static struct v4l2_ctrl *new_unit_size_ctrl(struct v4l2_ctrl_handler *handler)
> -{
> - static struct v4l2_ctrl_config ctrl = {
> - .id = V4L2_CID_UNIT_CELL_SIZE,
> - .type_ops = &unit_size_ops,
> - };
> -
> - return v4l2_ctrl_new_custom(handler, &ctrl, NULL);
> -}
> static int imx214_probe(struct i2c_client *client)
> {
> struct device *dev = &client->dev;
> @@ -969,6 +949,10 @@ static int imx214_probe(struct i2c_client *client)
> static const s64 link_freq[] = {
> IMX214_DEFAULT_LINK_FREQ,
> };
> + struct v4l2_area unit_size = {
> + .width = 1120,
> + .height = 1120,
> + };
> int ret;
>
> ret = imx214_parse_fwnode(dev);
> @@ -1050,7 +1034,10 @@ static int imx214_probe(struct i2c_client *client)
> V4L2_CID_EXPOSURE,
> 0, 3184, 1, 0x0c70);
>
> - imx214->unit_size = new_unit_size_ctrl(&imx214->ctrls);
> + imx214->unit_size = v4l2_ctrl_new_area(&imx214->ctrls,
> + &imx214_ctrl_ops,
> + V4L2_CID_UNIT_CELL_SIZE,
> + &unit_size);
>
> ret = imx214->ctrls.error;
> if (ret) {
> --
> 2.23.0.rc1
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists