Instead of creating manually the V4L2_CID_UNIT_CELL_SIZE control, lets use the helper. Signed-off-by: Ricardo Ribalda Delgado <ribalda@xxxxxxxxxx> --- 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