Message ID | 20201109164934.134919-11-jacopo@jmondi.org |
---|---|
State | Superseded |
Headers | show |
Series | media: ov5647: Support RaspberryPi Camera Module v1 | expand |
diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index f18e3ad342ebf..d386791f87500 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -460,10 +460,17 @@ static const struct v4l2_subdev_core_ops ov5647_subdev_core_ops = { static int ov5647_s_stream(struct v4l2_subdev *sd, int enable) { + struct ov5647 *sensor = to_state(sd); + int ret; + + mutex_lock(&sensor->lock); if (enable) - return ov5647_stream_on(sd); + ret = ov5647_stream_on(sd); else - return ov5647_stream_off(sd); + ret = ov5647_stream_off(sd); + mutex_unlock(&sensor->lock); + + return ret; } static const struct v4l2_subdev_video_ops ov5647_subdev_video_ops = {
Use the driver mutex to protect s_stream() operations. This will become more relevant once the sensor will support more formats and set_format() could be issue concurrently to s_stream(). Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- drivers/media/i2c/ov5647.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)