Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: i2c: ov5647: use our own mutex for the ctrl lock
@ 2025-12-01  0:00 Xiaolei Wang
  2025-12-01  9:31 ` johannes.goede
  2025-12-04 10:11 ` Sakari Ailus
  0 siblings, 2 replies; 8+ messages in thread
From: Xiaolei Wang @ 2025-12-01  0:00 UTC (permalink / raw)
  To: sakari.ailus, dave.stevenson, jacopo, mchehab,
	prabhakar.mahadev-lad.rj, laurent.pinchart, hverkuil+cisco,
	Xiaolei.Wang
  Cc: linux-media, linux-kernel

__v4l2_ctrl_handler_setup() and __v4l2_ctrl_modify_range()
contains an assertion to verify that the v4l2_ctrl_handler::lock
is held, as it should only be called when the lock has already
been acquired. Therefore use our own mutex for the ctrl lock,
otherwise a warning will be  reported.

Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
 drivers/media/i2c/ov5647.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
index e193fef4fced..4e14eefba577 100644
--- a/drivers/media/i2c/ov5647.c
+++ b/drivers/media/i2c/ov5647.c
@@ -1288,9 +1288,12 @@ static int ov5647_init_controls(struct ov5647 *sensor)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
 	int hblank, exposure_max, exposure_def;
+	struct v4l2_ctrl_handler *hdl = &sensor->ctrls;
 
 	v4l2_ctrl_handler_init(&sensor->ctrls, 9);
 
+	hdl->lock = &sensor->lock;
+
 	v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
 			  V4L2_CID_AUTOGAIN, 0, 1, 1, 0);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-04 10:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-01  0:00 [PATCH] media: i2c: ov5647: use our own mutex for the ctrl lock Xiaolei Wang
2025-12-01  9:31 ` johannes.goede
2025-12-01 13:02   ` Sakari Ailus
2025-12-01 13:58     ` Jacopo Mondi
2025-12-01 16:06       ` Dave Stevenson
2025-12-02  3:18         ` xiaolei wang
2025-12-04 10:11 ` Sakari Ailus
2025-12-04 10:57   ` xiaolei wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox