Thread (23 messages) 23 messages, 4 authors, 2019-09-12
STALE2487d

[PATCH v3 7/7] imx214: Use v4l2_ctrl_new_area helper

From: Ricardo Ribalda Delgado <ribalda@kernel.org>
Date: 2019-08-23 12:38:14
Also in: lkml
Subsystem: media input infrastructure (v4l/dvb), sony imx214 sensor driver, the rest, v4l2 camera sensor drivers · Maintainers: Mauro Carvalho Chehab, Ricardo Ribalda, Linus Torvalds, Sakari Ailus

Instead of creating manually the V4L2_CID_UNIT_CELL_SIZE control, lets
use the helper.

Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help