lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240929134354.20735-3-laurent.pinchart@ideasonboard.com>
Date: Sun, 29 Sep 2024 16:43:53 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: rmfrfs@...il.com,
	martink@...teo.de,
	kernel@...i.sm,
	mchehab@...nel.org,
	shawnguo@...nel.org,
	s.hauer@...gutronix.de,
	kernel@...gutronix.de,
	festevam@...il.com
Cc: guoniu.zhou@....nxp.com,
	imx@...ts.linux.dev,
	linux-media@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] media: imx8mq-mipi-csi2: Drop ST_SUSPENDED guard

The ST_SUSPENDED flag is set at system suspend and cleared at either
system resume or runtime resume. It is then used in two locations:

- In .s_stream(), when starting the stream to return -EBUSY if the
  device is suspended. This can't happen, As the function calls
  pm_runtime_resume_and_get() just before the check, which clears the
  ST_SUSPENDED flag.

- In imx8mq_mipi_csi_resume() to skip resuming if the device isn't
  suspended. As imx8mq_mipi_csi_resume() is the system resume handler,
  the device is by definition suspended.

The ST_SUSPENDED flag is therefore not needed. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
---
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
index 8eb9c7049425..0f56a40abf33 100644
--- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
+++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c
@@ -64,7 +64,6 @@
 
 enum {
 	ST_POWERED	= 1,
-	ST_SUSPENDED	= 4,
 };
 
 enum imx8mq_mipi_csi_clk {
@@ -404,11 +403,6 @@ static int imx8mq_mipi_csi_s_stream(struct v4l2_subdev *sd, int enable)
 	mutex_lock(&state->lock);
 
 	if (enable) {
-		if (state->state & ST_SUSPENDED) {
-			ret = -EBUSY;
-			goto unlock;
-		}
-
 		sd_state = v4l2_subdev_lock_and_get_active_state(sd);
 		ret = imx8mq_mipi_csi_start_stream(state, sd_state);
 		v4l2_subdev_unlock_state(sd_state);
@@ -673,8 +667,6 @@ static int imx8mq_mipi_csi_pm_resume(struct device *dev)
 		ret = imx8mq_mipi_csi_clk_enable(state);
 	}
 
-	state->state &= ~ST_SUSPENDED;
-
 	mutex_unlock(&state->lock);
 
 	return ret ? -EAGAIN : 0;
@@ -682,24 +674,13 @@ static int imx8mq_mipi_csi_pm_resume(struct device *dev)
 
 static int imx8mq_mipi_csi_suspend(struct device *dev)
 {
-	struct v4l2_subdev *sd = dev_get_drvdata(dev);
-	struct csi_state *state = mipi_sd_to_csi2_state(sd);
-
 	imx8mq_mipi_csi_pm_suspend(dev);
 
-	state->state |= ST_SUSPENDED;
-
 	return 0;
 }
 
 static int imx8mq_mipi_csi_resume(struct device *dev)
 {
-	struct v4l2_subdev *sd = dev_get_drvdata(dev);
-	struct csi_state *state = mipi_sd_to_csi2_state(sd);
-
-	if (!(state->state & ST_SUSPENDED))
-		return 0;
-
 	return imx8mq_mipi_csi_pm_resume(dev);
 }
 
-- 
Regards,

Laurent Pinchart


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ