diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2020-11-19 17:32:30 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-01-12 16:10:53 +0100 |
commit | ab614f27569ffab2441cc8f45fc24b6467aafb3c (patch) | |
tree | a3f119db16e12f31977f6ba57f4d0f683ea6b8c5 /drivers/media/i2c/ov5647.c | |
parent | 464090c0af3de6f3fe3a6329f524eadb6a8d9744 (diff) | |
download | linux-ab614f27569ffab2441cc8f45fc24b6467aafb3c.tar.bz2 |
media: ov5647: Protect s_stream() with mutex
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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c/ov5647.c')
-rw-r--r-- | drivers/media/i2c/ov5647.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index 2e7a6cb39689..69a5e25dcd70 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -462,10 +462,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 = { |