From patchwork Sun Sep 29 13:36:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 831756 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EBB1117BB13; Sun, 29 Sep 2024 13:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727617015; cv=none; b=MS8ug7BoZMSQ50kPa3iYcYaVp2DgB5iFXN/wh5naa+1oa/YYIsJerbPH+5nH6tdjS2QjC1NQtYDGurMIO+1Pcmnc5pzbKuF5xagNZXneNt3RLNoNFcJ3aMA96ZsKlW3shPFz2/9Q1A31dt+8NAKEcohp/w3wTbeVvjtZPWyUeZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727617015; c=relaxed/simple; bh=oMfSYlB7P9eLwoLyD1PZzgkE2aC3vO/4RvgIGutTDEI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a2YR/9TD8hFZYZxkJxe3nnHjBYAD4b3E6Lvhy8Ou8Yfb3C+ys5eCnCZaB1gPL0TPIBtWYsctCz8bcEQ2IgjtC9I3q/x7K7kOYRWflPCjS3W/9aPnVeg3l6zKhKRmE2hqwiJ6JQbaibd5hQktR1Q8G7kqFzdA1EJf/rNwNIvNWj8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=VA0vNGsW; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="VA0vNGsW" Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 964486DE; Sun, 29 Sep 2024 15:35:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727616921; bh=oMfSYlB7P9eLwoLyD1PZzgkE2aC3vO/4RvgIGutTDEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VA0vNGsWTljhT2+PijnAn9bDQP6Fy7jjAomFTPt8yOjNixZXHcgOUczeokhftQDCD QAxfKbj9VO1XriMdu7cYmGhwtWWDLimX+6GOI3cDmBIiMiLL54NMBSOK0ezQ83Uhk1 Vg6k3AZ/hV/XO/c8pko4+Fg0Rv4gEbitPJ5WtDWQ= From: Laurent Pinchart To: Cc: guoniu.zhou@oss.nxp.com, imx@lists.linux.dev, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] media: imx8mq-mipi-csi2: Drop ST_SUSPENDED guard Date: Sun, 29 Sep 2024 16:36:41 +0300 Message-ID: <20240929133646.19991-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240929133646.19991-1-laurent.pinchart@ideasonboard.com> References: <20240929133646.19991-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- 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); }