From nobody Mon Apr 6 17:27:47 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 944A73859DF; Thu, 19 Mar 2026 02:04:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773885877; cv=none; b=s28h9gMeITO08eYk8L+tRF2paeZlkekn/QlD+wxlx0DNlhQcAeVEg/CJNWiDP5gpn7YmW3ZqsAXkNzE+Ts5U3SZcToThk+UEcilS1C9+wvptdoTp5SKn1rJOlX8Bh8wghI3nOWBqq3Ovo8DInIEqxKGAy5xjXqZpOn1i73fd0G8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773885877; c=relaxed/simple; bh=ZKgId+XuKb7dmeAODL3HqlCFsqUj9KiAZsqmGeZ/icc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=I/S20LUCI6wZyHJiE42aAz5edmFVBNLaWJ2Z6c2dFG9MhtIbfFdMIMhQQXhUxaMxEkN7nPpF7jaWF5UW1ukhCcrmD/p6YOjAohSp8H4rFiNTyPBaITtVLLRmL/GfuWyxD76JqKFy1m20GfrWw8anjA8/tZn5ANAg31YtqykxRuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: f582e0ea233711f1a21c59e7364eecb8-20260319 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.11,REQID:e918a92d-3266-4741-8843-5ab7bb1fa260,IP:0,U RL:0,TC:0,Content:-25,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:89c9d04,CLOUDID:9730383e14a457566eca870e6a4b8b8f,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850|898,TC:nil,Content:0|15|50 ,EDM:5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OS A:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: f582e0ea233711f1a21c59e7364eecb8-20260319 X-User: xiaopei01@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 91165205; Thu, 19 Mar 2026 10:04:27 +0800 From: Pei Xiao To: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, openbmc@lists.ozlabs.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, broonie@kernel.org, Frank.Li@nxp.com, amelie.delaunay@foss.st.com Cc: Pei Xiao Subject: [PATCH v5 17/17] spi: zynqmp-gqspi: Simplify clock handling with devm_clk_get_enabled() Date: Thu, 19 Mar 2026 10:04:13 +0800 Message-Id: <611b4c4b67aaa8d86a7aeba9707ada47e6fd5dc3.1773885292.git.xiaopei01@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace devm_clk_get() followed by clk_prepare_enable() with devm_clk_get_enabled() for both "pclk" and "ref_clk". This removes the need for explicit clock enable and disable calls, as the managed API automatically disables the clocks on device removal or probe failure. Remove the now-unnecessary clk_disable_unprepare() calls from the probe error paths and the remove callback. Signed-off-by: Pei Xiao --- drivers/spi/spi-zynqmp-gqspi.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 502fd5eccc83..a7e135607e2a 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -1244,26 +1244,16 @@ static int zynqmp_qspi_probe(struct platform_device= *pdev) if (IS_ERR(xqspi->regs)) return PTR_ERR(xqspi->regs); =20 - xqspi->pclk =3D devm_clk_get(&pdev->dev, "pclk"); + xqspi->pclk =3D devm_clk_get_enabled(&pdev->dev, "pclk"); if (IS_ERR(xqspi->pclk)) return dev_err_probe(dev, PTR_ERR(xqspi->pclk), "pclk clock not found.\n"); =20 - xqspi->refclk =3D devm_clk_get(&pdev->dev, "ref_clk"); + xqspi->refclk =3D devm_clk_get_enabled(&pdev->dev, "ref_clk"); if (IS_ERR(xqspi->refclk)) return dev_err_probe(dev, PTR_ERR(xqspi->refclk), "ref_clk clock not found.\n"); =20 - ret =3D clk_prepare_enable(xqspi->pclk); - if (ret) - return dev_err_probe(dev, ret, "Unable to enable APB clock.\n"); - - ret =3D clk_prepare_enable(xqspi->refclk); - if (ret) { - dev_err(dev, "Unable to enable device clock.\n"); - goto clk_dis_pclk; - } - init_completion(&xqspi->data_completion); =20 mutex_init(&xqspi->op_lock); @@ -1339,9 +1329,6 @@ static int zynqmp_qspi_probe(struct platform_device *= pdev) pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); - clk_disable_unprepare(xqspi->refclk); -clk_dis_pclk: - clk_disable_unprepare(xqspi->pclk); =20 return ret; } @@ -1368,8 +1355,6 @@ static void zynqmp_qspi_remove(struct platform_device= *pdev) pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); - clk_disable_unprepare(xqspi->refclk); - clk_disable_unprepare(xqspi->pclk); } =20 MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match); --=20 2.25.1