[PATCH 2/3] media: i2c: imx219: Serialize during stream start/stop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Serialize during stream start/stop in suspend/resume callbacks.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
---
 drivers/media/i2c/imx219.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index f0cf1985a4dc..87c021de1460 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -1172,8 +1172,10 @@ static int __maybe_unused imx219_suspend(struct device *dev)
 	struct v4l2_subdev *sd = dev_get_drvdata(dev);
 	struct imx219 *imx219 = to_imx219(sd);
 
+	mutex_lock(&imx219->mutex);
 	if (imx219->streaming)
 		imx219_stop_streaming(imx219);
+	mutex_unlock(&imx219->mutex);
 
 	return 0;
 }
@@ -1184,11 +1186,13 @@ static int __maybe_unused imx219_resume(struct device *dev)
 	struct imx219 *imx219 = to_imx219(sd);
 	int ret;
 
+	mutex_lock(&imx219->mutex);
 	if (imx219->streaming) {
 		ret = imx219_start_streaming(imx219);
 		if (ret)
 			goto error;
 	}
+	mutex_unlock(&imx219->mutex);
 
 	return 0;
 
@@ -1197,6 +1201,7 @@ static int __maybe_unused imx219_resume(struct device *dev)
 	imx219->streaming = false;
 	__v4l2_ctrl_grab(imx219->vflip, false);
 	__v4l2_ctrl_grab(imx219->hflip, false);
+	mutex_unlock(&imx219->mutex);
 
 	return ret;
 }
-- 
2.17.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux