linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: linux-media@vger.kernel.org
Cc: mchehab@kernel.org, sakari.ailus@linux.intel.com,
	hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com,
	roman.kovalivskyi@globallogic.com,
	dafna.hirschfeld@collabora.com, dave.stevenson@raspberrypi.org,
	naush@raspberrypi.com, erosca@de.adit-jv.com,
	Jacopo Mondi <jacopo@jmondi.org>
Subject: [PATCH v4 11/30] media: ov5647: Protect s_stream() with mutex
Date: Thu, 19 Nov 2020 17:32:30 +0100	[thread overview]
Message-ID: <20201119163238.783142-2-jacopo@jmondi.org> (raw)
In-Reply-To: <20201119163238.783142-1-jacopo@jmondi.org>

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(-)

diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
index 2e7a6cb396890..69a5e25dcd707 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 = {
-- 
2.29.1


  reply	other threads:[~2020-11-19 16:34 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 16:19 [PATCH v4 00/30] media: ov5647: Support RaspberryPi Camera Module v1 Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 01/30] dt-bindings: media: i2c: Rename ov5647.yaml Jacopo Mondi
2020-11-25  9:15   ` Sakari Ailus
2020-12-21 17:34     ` Jacopo Mondi
2020-12-22  9:43       ` Sakari Ailus
2020-12-21 20:23     ` Rob Herring
2020-12-22  9:50       ` Sakari Ailus
2021-01-14 20:20         ` Rob Herring
2021-01-15  9:03           ` Jacopo Mondi
2021-01-15  9:26             ` Sakari Ailus
2020-11-19 16:19 ` [PATCH v4 02/30] media: ov5647: Add support for PWDN GPIO Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 03/30] media: ov5647: Add support for non-continuous clock mode Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 04/30] media: ov5647: Add set_fmt and get_fmt calls Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 05/30] media: ov5647: Fix format initialization Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 06/30] media: ov5647: Fix style issues Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 07/30] media: ov5647: Replace license with SPDX identifier Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 08/30] media: ov5647: Fix return value from read/write Jacopo Mondi
2020-11-19 16:19 ` [PATCH v4 09/30] media: ov5647: Program mode at s_stream(1) time Jacopo Mondi
2020-11-19 16:32 ` [PATCH v4 10/30] media: ov5647: Implement enum_frame_size() Jacopo Mondi
2020-11-19 16:32   ` Jacopo Mondi [this message]
2020-11-19 16:32   ` [PATCH v4 12/30] media: ov5647: Support gain, exposure and AWB controls Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 13/30] media: ov5647: Rationalize driver structure name Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 14/30] media: ov5647: Break out format handling Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 15/30] media: ov5647: Add support for get_selection() Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 16/30] media: ov5647: Rename SBGGR8 VGA mode Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 17/30] media: ov5647: Add SGGBR10_1X10 modes Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 18/30] media: ov5647: Use SBGGR10_1X10 640x480 as default Jacopo Mondi
2020-11-19 16:32   ` [PATCH v4 19/30] media: ov5647: Implement set_fmt pad operation Jacopo Mondi
2020-11-19 16:35 ` [PATCH v4 20/30] media: ov5647: Set V4L2_SUBDEV_FL_HAS_EVENTS flag Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 21/30] media: ov5647: Support V4L2_CID_PIXEL_RATE Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 22/30] media: ov5647: Support V4L2_CID_HBLANK control Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 23/30] media: ov5647: Support V4L2_CID_VBLANK control Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 24/30] media: ov5647: Advertise the correct exposure range Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 25/30] media: ov5647: Use pm_runtime infrastructure Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 26/30] media: ov5647: Rework s_stream() operation Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 27/30] media: ov5647: Apply controls only when powered Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 28/30] media: ov5647: Constify oe_enable/disable reglist Jacopo Mondi
2020-11-19 16:35   ` [PATCH v4 29/30] media: ov5647: Support VIDIOC_SUBSCRIBE_EVENT Jacopo Mondi
2020-11-19 16:37 ` [PATCH v4 30/30] media: ov5647: Remove 640x480 SBGGR8 mode Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201119163238.783142-2-jacopo@jmondi.org \
    --to=jacopo@jmondi.org \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=dave.stevenson@raspberrypi.org \
    --cc=erosca@de.adit-jv.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=naush@raspberrypi.com \
    --cc=roman.kovalivskyi@globallogic.com \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).