From patchwork Sun Sep 29 13:36:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13815099 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 1C1B41779A9 for ; Sun, 29 Sep 2024 13:36:51 +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=1727617013; cv=none; b=jEd/WFS77N/s4iRieBHqviweHd9xDXSlqr8dhNYvh2mMcQJDH3fTo6A+77dWgO4XcwiuMITh5RC1UVDV5AwxIM/W9vPUk0pwrp2tDNalg0VkP/T5ZUy6vzejvVN9qBYH8q07FJnP5ZNwWfWKGZKeJOVa7CYb08GOJNdnKJ4fbSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727617013; c=relaxed/simple; bh=OcwnUVuhMtXnLLH9oEg60Lun1uQvDGaKMD6lqbREbb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P7IhKTFF4YnNneBC6KCgiJi8DepxQJuAkQL4E2FmrXkk+oKA7DTY+1QriN8IpoN1ly7a1EAXPR2bDipvsF1vv6k8NpwKe4v/ozg+y4vB4LSBFj8HfhDWwWkv2K0OeoOe1PzPexkVPT4O8oAJlX9mPNKdz20OmhpIATSCt0x0R5o= 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=ozIcoAtM; 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="ozIcoAtM" Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 30B8A227; Sun, 29 Sep 2024 15:35:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727616920; bh=OcwnUVuhMtXnLLH9oEg60Lun1uQvDGaKMD6lqbREbb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ozIcoAtM2HkBfIVmBPyeQ4Ty0McQdDMf75iwy2vb8YFnugvwHVug1C31Fo1apPKMh 3QBLKfhlWF0xN1FrhPIDpLsVaMH0w9P3OJOtd4DkaT7QOqxbEwDkFFrlfsHShU8q/7 FUwuVOrSfVrRo4o+t6zD/dfzgkb6KnZWSka4ge1I= 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 1/3] media: imx8mq-mipi-csi2: Drop stream stop/restart at suspend/resume time Date: Sun, 29 Sep 2024 16:36:40 +0300 Message-ID: <20240929133646.19991-2-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: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The imx8mq-mipi-csi2 driver stops streaming at suspend time, and restarts it at resume time, in both the runtime and system suspend/resume handlers. This isn't needed: - The device is runtime resumed only from the .s_stream() handler, before starting streaming, and runtime suspended in the same function, after stopping streaming. - For system suspend/resume, the whole capture pipeline is stopped and restarted in a controlled manner by the top-level driver (the CSI bridge in this case). When the system suspend handler is called, streaming will have been stopped already. Drop stream stop/restart from the PM handlers. Signed-off-by: Laurent Pinchart --- drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c index d4a6c5532969..8eb9c7049425 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_STREAMING = 2, ST_SUSPENDED = 4, }; @@ -420,12 +419,9 @@ static int imx8mq_mipi_csi_s_stream(struct v4l2_subdev *sd, int enable) ret = v4l2_subdev_call(state->src_sd, video, s_stream, 1); if (ret < 0) goto unlock; - - state->state |= ST_STREAMING; } else { v4l2_subdev_call(state->src_sd, video, s_stream, 0); imx8mq_mipi_csi_stop_stream(state); - state->state &= ~ST_STREAMING; } unlock: @@ -668,7 +664,6 @@ static int imx8mq_mipi_csi_pm_resume(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct csi_state *state = mipi_sd_to_csi2_state(sd); - struct v4l2_subdev_state *sd_state; int ret = 0; mutex_lock(&state->lock); @@ -677,17 +672,9 @@ static int imx8mq_mipi_csi_pm_resume(struct device *dev) state->state |= ST_POWERED; ret = imx8mq_mipi_csi_clk_enable(state); } - if (state->state & ST_STREAMING) { - 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); - if (ret) - goto unlock; - } state->state &= ~ST_SUSPENDED; -unlock: mutex_unlock(&state->lock); return ret ? -EAGAIN : 0; 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: 13815100 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 7114F17BEAD for ; Sun, 29 Sep 2024 13:36:54 +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: imx@lists.linux.dev 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); } From patchwork Sun Sep 29 13:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13815101 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 3A07017C219 for ; Sun, 29 Sep 2024 13:36:54 +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=1727617016; cv=none; b=iGP9ZZFWQT4hk9rXSHJmMHmcayoRciVJjJqMdxt60bc+GFv4cLBo39FamUbVIDcqiUd82AJIWGMcQRIsGTs56NQmYryJu2h8ENCD4hafd8/yT+bMlYIOx8+IQqnz7DIZYRt3ZwEv++2T5Tnn+gqlEIr0lUS/xgLjLeY8mTKcenE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727617016; c=relaxed/simple; bh=BJyfg/bYawpzN0ZweGvRjC/Ui3Wm3vXBCxldTdF1wbg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MLkD0/2BleM7rqpTefDVHv5Dlh2hdWaljGQohzsIPDzgPC9ViEaoxcWYWKD9CV5BWy3FlCa6bBp38EDQYBo+fE2u3/klrYoqU24VxHc081RVElJACBALp527zD60NQIuyK8GJJys+EvTRj8f8NdUCvLYTsE5AFeTxfXb9U74cyk= 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=RAEqK46P; 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="RAEqK46P" Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 09ABEA98; Sun, 29 Sep 2024 15:35:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727616923; bh=BJyfg/bYawpzN0ZweGvRjC/Ui3Wm3vXBCxldTdF1wbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RAEqK46PDeGCHxt3bNDUacZQxVSSZYxtXDNULSH9ogiRWl8F+Wxstu7jRaygvr/pF gDzWaDs7Pv/XkfK+tUb5F/HLlpjo+PfoOYgjDQnT72H0eYbgO8yaQgMUXlVZMNpeKV er7MlV9TJvAw/XQcyCYtRtm3Lo//OLOI1Nd+nN6I= 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 3/3] media: imx8mq-mipi-csi2: Drop system suspend/resume handlers Date: Sun, 29 Sep 2024 16:36:42 +0300 Message-ID: <20240929133646.19991-4-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: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Video capture pipelines are suspended and resumes in a controlled manner by the top-level driver (the CSI bridge driver in this case), to ensure proper synchronization of sources and sinks. There is therefore no need for system suspend/resume handlers in the imx8mq-mipi-csi2 driver. Drop them. Signed-off-by: Laurent Pinchart --- drivers/media/platform/nxp/imx8mq-mipi-csi2.c | 81 +++---------------- 1 file changed, 10 insertions(+), 71 deletions(-) diff --git a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c index 0f56a40abf33..54b2de09692b 100644 --- a/drivers/media/platform/nxp/imx8mq-mipi-csi2.c +++ b/drivers/media/platform/nxp/imx8mq-mipi-csi2.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -62,10 +61,6 @@ #define CSI2RX_CFG_VID_P_FIFO_SEND_LEVEL 0x188 #define CSI2RX_CFG_DISABLE_PAYLOAD_1 0x130 -enum { - ST_POWERED = 1, -}; - enum imx8mq_mipi_csi_clk { CSI2_CLK_CORE, CSI2_CLK_ESC, @@ -116,9 +111,6 @@ struct csi_state { struct v4l2_mbus_config_mipi_csi2 bus; - struct mutex lock; /* Protect state */ - u32 state; - struct regmap *phy_gpr; u8 phy_gpr_reg; @@ -400,27 +392,23 @@ static int imx8mq_mipi_csi_s_stream(struct v4l2_subdev *sd, int enable) return ret; } - mutex_lock(&state->lock); - if (enable) { 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); if (ret < 0) - goto unlock; + goto out; ret = v4l2_subdev_call(state->src_sd, video, s_stream, 1); if (ret < 0) - goto unlock; + goto out; } else { v4l2_subdev_call(state->src_sd, video, s_stream, 0); imx8mq_mipi_csi_stop_stream(state); } -unlock: - mutex_unlock(&state->lock); - +out: if (!enable || ret < 0) pm_runtime_put(state->dev); @@ -638,59 +626,14 @@ static int imx8mq_mipi_csi_async_register(struct csi_state *state) * Suspend/resume */ -static void imx8mq_mipi_csi_pm_suspend(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct csi_state *state = mipi_sd_to_csi2_state(sd); - - mutex_lock(&state->lock); - - if (state->state & ST_POWERED) { - imx8mq_mipi_csi_stop_stream(state); - imx8mq_mipi_csi_clk_disable(state); - state->state &= ~ST_POWERED; - } - - mutex_unlock(&state->lock); -} - -static int imx8mq_mipi_csi_pm_resume(struct device *dev) -{ - struct v4l2_subdev *sd = dev_get_drvdata(dev); - struct csi_state *state = mipi_sd_to_csi2_state(sd); - int ret = 0; - - mutex_lock(&state->lock); - - if (!(state->state & ST_POWERED)) { - state->state |= ST_POWERED; - ret = imx8mq_mipi_csi_clk_enable(state); - } - - mutex_unlock(&state->lock); - - return ret ? -EAGAIN : 0; -} - -static int imx8mq_mipi_csi_suspend(struct device *dev) -{ - imx8mq_mipi_csi_pm_suspend(dev); - - return 0; -} - -static int imx8mq_mipi_csi_resume(struct device *dev) -{ - return imx8mq_mipi_csi_pm_resume(dev); -} - static int imx8mq_mipi_csi_runtime_suspend(struct device *dev) { struct v4l2_subdev *sd = dev_get_drvdata(dev); struct csi_state *state = mipi_sd_to_csi2_state(sd); int ret; - imx8mq_mipi_csi_pm_suspend(dev); + imx8mq_mipi_csi_stop_stream(state); + imx8mq_mipi_csi_clk_disable(state); ret = icc_set_bw(state->icc_path, 0, 0); if (ret) @@ -711,13 +654,14 @@ static int imx8mq_mipi_csi_runtime_resume(struct device *dev) return ret; } - return imx8mq_mipi_csi_pm_resume(dev); + ret = imx8mq_mipi_csi_clk_enable(state); + + return ret ? -EAGAIN : 0; } static const struct dev_pm_ops imx8mq_mipi_csi_pm_ops = { RUNTIME_PM_OPS(imx8mq_mipi_csi_runtime_suspend, imx8mq_mipi_csi_runtime_resume, NULL) - SYSTEM_SLEEP_PM_OPS(imx8mq_mipi_csi_suspend, imx8mq_mipi_csi_resume) }; /* ----------------------------------------------------------------------------- @@ -854,15 +798,13 @@ static int imx8mq_mipi_csi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, &state->sd); - mutex_init(&state->lock); - ret = imx8mq_mipi_csi_subdev_init(state); if (ret < 0) - goto mutex; + return ret; ret = imx8mq_mipi_csi_init_icc(pdev); if (ret) - goto mutex; + return ret; /* Enable runtime PM. */ pm_runtime_enable(dev); @@ -889,8 +831,6 @@ static int imx8mq_mipi_csi_probe(struct platform_device *pdev) v4l2_async_unregister_subdev(&state->sd); icc: imx8mq_mipi_csi_release_icc(pdev); -mutex: - mutex_destroy(&state->lock); return ret; } @@ -908,7 +848,6 @@ static void imx8mq_mipi_csi_remove(struct platform_device *pdev) imx8mq_mipi_csi_runtime_suspend(&pdev->dev); media_entity_cleanup(&state->sd.entity); v4l2_subdev_cleanup(&state->sd); - mutex_destroy(&state->lock); pm_runtime_set_suspended(&pdev->dev); imx8mq_mipi_csi_release_icc(pdev); }