All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alain Volmat <alain.volmat@foss.st.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Sylvain Petinot <sylvain.petinot@foss.st.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Alain Volmat <alain.volmat@foss.st.com>,
	<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/7] media: i2c: st-mipid02: don't keep track of streaming status
Date: Sat, 25 Nov 2023 19:20:50 +0100	[thread overview]
Message-ID: <20231125182057.1379357-3-alain.volmat@foss.st.com> (raw)
In-Reply-To: <20231125182057.1379357-1-alain.volmat@foss.st.com>

As explained in the following series, subdev do not have to keep
track of their streaming status:

https://lore.kernel.org/linux-media/20230914181704.4811-1-laurent.pinchart@ideasonboard.com/

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
---
 drivers/media/i2c/st-mipid02.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
index b699f0b4efe7..1efaa54866a8 100644
--- a/drivers/media/i2c/st-mipid02.c
+++ b/drivers/media/i2c/st-mipid02.c
@@ -112,7 +112,6 @@ struct mipid02_dev {
 	} r;
 	/* lock to protect all members below */
 	struct mutex lock;
-	bool streaming;
 	struct v4l2_mbus_framefmt fmt;
 };
 
@@ -629,22 +628,13 @@ static int mipid02_s_stream(struct v4l2_subdev *sd, int enable)
 	struct i2c_client *client = bridge->i2c_client;
 	int ret = 0;
 
-	dev_dbg(&client->dev, "%s : requested %d / current = %d", __func__,
-		    enable, bridge->streaming);
-	mutex_lock(&bridge->lock);
-
-	if (bridge->streaming == enable)
-		goto out;
+	dev_dbg(&client->dev, "%s : requested %d\n", __func__, enable);
 
 	ret = enable ? mipid02_stream_enable(bridge) :
 		       mipid02_stream_disable(bridge);
-	if (!ret)
-		bridge->streaming = enable;
-
-out:
-	dev_dbg(&client->dev, "%s current now = %d / %d", __func__,
-		    bridge->streaming, ret);
-	mutex_unlock(&bridge->lock);
+	if (ret)
+		dev_err(&client->dev, "failed to stream %s (%d)\n",
+			enable ? "enable" : "disable", ret);
 
 	return ret;
 }
@@ -777,20 +767,14 @@ static int mipid02_set_fmt(struct v4l2_subdev *sd,
 
 	mutex_lock(&bridge->lock);
 
-	if (bridge->streaming) {
-		ret = -EBUSY;
-		goto error;
-	}
-
 	if (format->pad == MIPID02_SOURCE)
 		mipid02_set_fmt_source(sd, sd_state, format);
 	else
 		mipid02_set_fmt_sink(sd, sd_state, format);
 
-error:
 	mutex_unlock(&bridge->lock);
 
-	return ret;
+	return 0;
 }
 
 static const struct v4l2_subdev_video_ops mipid02_video_ops = {
-- 
2.25.1


  parent reply	other threads:[~2023-11-25 18:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-25 18:20 [PATCH 0/7] media: i2c: st-mipid02: improvements / cleanups Alain Volmat
2023-11-25 18:20 ` [PATCH 1/7] media: i2c: st-mipid02: add usage of v4l2_get_link_freq Alain Volmat
2023-11-25 18:20 ` Alain Volmat [this message]
2023-11-25 18:20 ` [PATCH 3/7] media: i2c: st-mipid02: use cci_* helpers for register access Alain Volmat
2023-11-25 18:20 ` [PATCH 4/7] media: i2c: st-mipid02: use active state to store pad formats Alain Volmat
2023-11-28  6:40   ` Sakari Ailus
2023-11-28  7:26     ` Alain Volmat
2023-11-25 18:20 ` [PATCH 5/7] media: i2c: st-mipid02: use mipi-csi macro for data-type Alain Volmat
2023-11-25 18:20 ` [PATCH 6/7] media: i2c: st-mipid02: removal of unused link_frequency variable Alain Volmat
2023-11-25 18:20 ` [PATCH 7/7] media: i2c: st-mipid02: add Y8 format support Alain Volmat

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=20231125182057.1379357-3-alain.volmat@foss.st.com \
    --to=alain.volmat@foss.st.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sylvain.petinot@foss.st.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.