From: Li Zetao <lizetao1@huawei.com>
To: <lizetao1@huawei.com>
Cc: <alexandre.torgue@foss.st.com>,
<angelogioacchino.delregno@collabora.com>,
<christophe.kerello@foss.st.com>, <christophe.leroy@csgroup.eu>,
<dmitry.torokhov@gmail.com>, <frank.li@vivo.com>,
<geert+renesas@glider.be>, <heiko@sntech.de>,
<jernej.skrabec@gmail.com>, <jinpu.wang@ionos.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-mtd@lists.infradead.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-sunxi@lists.linux.dev>,
<martin.blumenstingl@googlemail.com>, <matthias.bgg@gmail.com>,
<mcoquelin.stm32@gmail.com>, <michael@walle.cc>,
<michal.simek@amd.com>, <miquel.raynal@bootlin.com>,
<nicolas.ferre@microchip.com>, <paul@crapouillou.net>,
<philmd@linaro.org>, <pratyush@kernel.org>, <richard@nod.at>,
<robh@kernel.org>, <rogerq@kernel.org>, <samuel@sholland.org>,
<stefan@agner.ch>, <tudor.ambarus@linaro.org>,
<u.kleine-koenig@pengutronix.de>, <vigneshr@ti.com>,
<vz@mleia.com>, <wens@csie.org>, <yangyingliang@huawei.com>
Subject: [PATCH -next v2 03/12] mtd: rawnand: fsmc: Use helper function devm_clk_get_enabled()
Date: Fri, 18 Aug 2023 15:46:33 +0800 [thread overview]
Message-ID: <20230818074642.308166-4-lizetao1@huawei.com> (raw)
In-Reply-To: <20230818074642.308166-1-lizetao1@huawei.com>
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared
and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be
replaced by devm_clk_get_enabled() when driver enable (and possibly
prepare) the clocks for the whole lifetime of the device. Moreover, it is
no longer necessary to unprepare and disable the clock explicitly. The
label "disable_clk" no longer makes sense, rename it to "disable_fsmc".
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
v1 -> v2: Modify commit message and rename the label "disable_clk" to "disable_fsmc"
v1: https://lore.kernel.org/all/20230817024509.3951629-4-lizetao1@huawei.com/
drivers/mtd/nand/raw/fsmc_nand.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index 7b4742420dfc..7d587284c9a5 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -1066,16 +1066,12 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
host->regs_va = base + FSMC_NOR_REG_SIZE +
(host->bank * FSMC_NAND_BANK_SZ);
- host->clk = devm_clk_get(&pdev->dev, NULL);
+ host->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(host->clk)) {
dev_err(&pdev->dev, "failed to fetch block clock\n");
return PTR_ERR(host->clk);
}
- ret = clk_prepare_enable(host->clk);
- if (ret)
- return ret;
-
/*
* This device ID is actually a common AMBA ID as used on the
* AMBA PrimeCell bus. However it is not a PrimeCell.
@@ -1111,7 +1107,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
if (!host->read_dma_chan) {
dev_err(&pdev->dev, "Unable to get read dma channel\n");
ret = -ENODEV;
- goto disable_clk;
+ goto disable_fsmc;
}
host->write_dma_chan = dma_request_channel(mask, filter, NULL);
if (!host->write_dma_chan) {
@@ -1155,9 +1151,8 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
release_dma_read_chan:
if (host->mode == USE_DMA_ACCESS)
dma_release_channel(host->read_dma_chan);
-disable_clk:
+disable_fsmc:
fsmc_nand_disable(host);
- clk_disable_unprepare(host->clk);
return ret;
}
@@ -1182,7 +1177,6 @@ static void fsmc_nand_remove(struct platform_device *pdev)
dma_release_channel(host->write_dma_chan);
dma_release_channel(host->read_dma_chan);
}
- clk_disable_unprepare(host->clk);
}
}
--
2.34.1
next prev parent reply other threads:[~2023-08-18 7:47 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 2:44 [PATCH -next 00/11] mtd: Use devm_clk_get_enabled() to simplify the drivers Li Zetao
2023-08-17 2:44 ` [PATCH -next 01/11] mtd: spear_smi: Use helper function devm_clk_get_enabled() Li Zetao
2023-08-17 2:45 ` [PATCH -next 02/11] mtd: rawnand: arasan: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 03/11] mtd: rawnand: fsmc: " Li Zetao
2023-08-17 8:31 ` Miquel Raynal
2023-08-17 2:45 ` [PATCH -next 04/11] mtd: rawnand: intel: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 05/11] mtd: rawnand: lpc32xx_slc: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 06/11] mtd: rawnand: mpc5121: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 07/11] mtd: rawnand: mtk: " Li Zetao
2023-08-17 8:34 ` Miquel Raynal
2023-08-17 2:45 ` [PATCH -next 08/11] mtd: rawnand: stm32_fmc2: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 09/11] mtd: rawnand: sunxi: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 10/11] mtd: rawnand: vf610_nfc: " Li Zetao
2023-08-17 2:45 ` [PATCH -next 11/11] mtd: spi-nor: " Li Zetao
2023-08-17 8:37 ` Miquel Raynal
2023-08-18 7:46 ` [PATCH -next v2 00/12] mtd: Use devm_clk_get_*() helper function to simplify the drivers Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 01/12] mtd: spear_smi: Use helper function devm_clk_get_enabled() Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 02/12] mtd: rawnand: arasan: " Li Zetao
2023-08-18 8:10 ` Miquel Raynal
2023-08-18 8:12 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 00/12] mtd: Use devm_clk_get_*() helper function to simplify the drivers Li Zetao
2023-08-21 3:17 ` [PATCH -next v3 01/12] mtd: spear_smi: Use helper function devm_clk_get_enabled() Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 02/12] mtd: rawnand: arasan: " Li Zetao
2023-08-21 7:58 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 03/12] mtd: rawnand: fsmc: " Li Zetao
2023-08-21 7:58 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 04/12] mtd: rawnand: intel: " Li Zetao
2023-08-21 7:58 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 05/12] mtd: rawnand: lpc32xx_slc: " Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 06/12] mtd: rawnand: mpc5121: " Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 07/12] mtd: rawnand: mtk: " Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 08/12] mtd: rawnand: stm32_fmc2: " Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 09/12] mtd: rawnand: sunxi: " Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 10/12] mtd: rawnand: vf610_nfc: " Li Zetao
2023-08-21 3:17 ` [PATCH -next v3 11/12] mtd: spi-nor: nxp-spifi: " Li Zetao
2023-08-21 7:38 ` Miquel Raynal
2023-08-21 7:54 ` Miquel Raynal
2023-08-21 3:17 ` [PATCH -next v3 12/12] mtd: rawnand: orion: Use helper function devm_clk_get_optional_enabled() Li Zetao
2023-08-21 7:57 ` Miquel Raynal
2023-08-18 7:46 ` Li Zetao [this message]
2023-08-18 8:11 ` [PATCH -next v2 03/12] mtd: rawnand: fsmc: Use helper function devm_clk_get_enabled() Miquel Raynal
2023-08-18 7:46 ` [PATCH -next v2 04/12] mtd: rawnand: intel: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 05/12] mtd: rawnand: lpc32xx_slc: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 06/12] mtd: rawnand: mpc5121: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 07/12] mtd: rawnand: mtk: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 08/12] mtd: rawnand: stm32_fmc2: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 09/12] mtd: rawnand: sunxi: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 10/12] mtd: rawnand: vf610_nfc: " Li Zetao
2023-08-18 7:46 ` [PATCH -next v2 11/12] mtd: spi-nor: nxp-spifi: " Li Zetao
2023-08-18 10:19 ` Tudor Ambarus
2023-08-18 7:46 ` [PATCH -next v2 12/12] mtd: rawnand: orion: Use helper function devm_clk_get_optional_enabled() Li Zetao
2023-08-18 10:28 ` (subset) [PATCH -next v2 00/12] mtd: Use devm_clk_get_*() helper function to simplify the drivers Tudor Ambarus
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=20230818074642.308166-4-lizetao1@huawei.com \
--to=lizetao1@huawei.com \
--cc=alexandre.torgue@foss.st.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=christophe.kerello@foss.st.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dmitry.torokhov@gmail.com \
--cc=frank.li@vivo.com \
--cc=geert+renesas@glider.be \
--cc=heiko@sntech.de \
--cc=jernej.skrabec@gmail.com \
--cc=jinpu.wang@ionos.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=martin.blumenstingl@googlemail.com \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=michael@walle.cc \
--cc=michal.simek@amd.com \
--cc=miquel.raynal@bootlin.com \
--cc=nicolas.ferre@microchip.com \
--cc=paul@crapouillou.net \
--cc=philmd@linaro.org \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=samuel@sholland.org \
--cc=stefan@agner.ch \
--cc=tudor.ambarus@linaro.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vigneshr@ti.com \
--cc=vz@mleia.com \
--cc=wens@csie.org \
--cc=yangyingliang@huawei.com \
/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