From: Pei Xiao <xiaopei01@kylinos.cn>
To: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.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
Cc: Pei Xiao <xiaopei01@kylinos.cn>
Subject: [PATCH v3 04/17] spi: img-spfi: Use helper function devm_clk_get_enabled()
Date: Tue, 17 Mar 2026 15:41:46 +0800 [thread overview]
Message-ID: <68a97f0be04a67a489ac8435e56cc75e4d009e13.1773733017.git.xiaopei01@kylinos.cn> (raw)
In-Reply-To: <cover.1773733017.git.xiaopei01@kylinos.cn>
devm_clk_get() and clk_prepare_enable() can now be replaced by
devm_clk_get_enabled() when driver enables the clocks. Moreover, it is no
longer necessary to unprepare and disable the clocks explicitly.
Simplify code.
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
drivers/spi/spi-img-spfi.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index 902fb64815c9..b45c6ceaffe2 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -557,24 +557,17 @@ static int img_spfi_probe(struct platform_device *pdev)
if (ret)
goto put_spi;
- spfi->sys_clk = devm_clk_get(spfi->dev, "sys");
+ spfi->sys_clk = devm_clk_get_enabled(spfi->dev, "sys");
if (IS_ERR(spfi->sys_clk)) {
ret = PTR_ERR(spfi->sys_clk);
goto put_spi;
}
- spfi->spfi_clk = devm_clk_get(spfi->dev, "spfi");
+ spfi->spfi_clk = devm_clk_get_enabled(spfi->dev, "spfi");
if (IS_ERR(spfi->spfi_clk)) {
ret = PTR_ERR(spfi->spfi_clk);
goto put_spi;
}
- ret = clk_prepare_enable(spfi->sys_clk);
- if (ret)
- goto put_spi;
- ret = clk_prepare_enable(spfi->spfi_clk);
- if (ret)
- goto disable_pclk;
-
spfi_reset(spfi);
/*
* Only enable the error (IACCESS) interrupt. In PIO mode we'll
@@ -655,9 +648,6 @@ static int img_spfi_probe(struct platform_device *pdev)
dma_release_channel(spfi->rx_ch);
if (spfi->tx_ch)
dma_release_channel(spfi->tx_ch);
- clk_disable_unprepare(spfi->spfi_clk);
-disable_pclk:
- clk_disable_unprepare(spfi->sys_clk);
put_spi:
spi_controller_put(host);
@@ -675,10 +665,6 @@ static void img_spfi_remove(struct platform_device *pdev)
dma_release_channel(spfi->rx_ch);
pm_runtime_disable(spfi->dev);
- if (!pm_runtime_status_suspended(spfi->dev)) {
- clk_disable_unprepare(spfi->spfi_clk);
- clk_disable_unprepare(spfi->sys_clk);
- }
}
#ifdef CONFIG_PM
--
2.25.1
next prev parent reply other threads:[~2026-03-17 7:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 7:41 [PATCH v3 00/17] cleanup in spi by use devm_clk_get_enabled Pei Xiao
2026-03-17 7:41 ` [PATCH v3 01/17] spi: axiado: Use helper function devm_clk_get_enabled() Pei Xiao
2026-03-17 13:19 ` Mark Brown
2026-03-18 15:05 ` kernel test robot
2026-03-17 7:41 ` [PATCH v3 02/17] spi: bcm63xx-hsspi: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 03/17] spi: bcmbca-hsspi: " Pei Xiao
2026-03-17 7:41 ` Pei Xiao [this message]
2026-03-17 7:41 ` [PATCH v3 05/17] spi: imx: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 06/17] spi: npcm-pspi: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 07/17] spi: orion: " Pei Xiao
2026-03-18 17:04 ` kernel test robot
2026-03-17 7:41 ` [PATCH v3 08/17] spi: rockchip-sfc: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 09/17] spi: sifive: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 10/17] spi: slave-mt27xx: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 11/17] spi: st: " Pei Xiao
2026-03-18 19:02 ` kernel test robot
2026-03-17 7:41 ` [PATCH v3 12/17] spi: stm32-qspi: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 13/17] spi: stm32: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 14/17] spi: sunplus-sp7021: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 15/17] spi: uniphier: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 16/17] spi: zynq-qspi: " Pei Xiao
2026-03-17 7:41 ` [PATCH v3 17/17] spi: zynqmp-gqspi: " Pei Xiao
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=68a97f0be04a67a489ac8435e56cc75e4d009e13.1773733017.git.xiaopei01@kylinos.cn \
--to=xiaopei01@kylinos.cn \
--cc=broonie@kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=openbmc@lists.ozlabs.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®