From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Li Zetao <lizetao1@huawei.com>
Cc: vigneshr@ti.com, geert+renesas@glider.be,
alexandre.torgue@foss.st.com, stefan@agner.ch,
paul@crapouillou.net, linux-mtd@lists.infradead.org,
christophe.leroy@csgroup.eu, jinpu.wang@ionos.com,
linux-stm32@st-md-mailman.stormreply.com, heiko@sntech.de,
robh@kernel.org, samuel@sholland.org, richard@nod.at,
wens@csie.org, jernej.skrabec@gmail.com,
tudor.ambarus@linaro.org, u.kleine-koenig@pengutronix.de,
linux-sunxi@lists.linux.dev, frank.li@vivo.com,
martin.blumenstingl@googlemail.com, yangyingliang@huawei.com,
vz@mleia.com, rogerq@kernel.org,
linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com,
michal.simek@amd.com, linux-arm-kernel@lists.infradead.org,
angelogioacchino.delregno@collabora.com,
christophe.kerello@foss.st.com, philmd@linaro.org,
dmitry.torokhov@gmail.com, michael@walle.cc,
mcoquelin.stm32@gmail.com, pratyush@kernel.org
Subject: Re: [PATCH -next 07/11] mtd: rawnand: mtk: Use helper function devm_clk_get_enabled()
Date: Thu, 17 Aug 2023 10:34:44 +0200 [thread overview]
Message-ID: <20230817103444.521d087f@xps-13> (raw)
In-Reply-To: <20230817024509.3951629-8-lizetao1@huawei.com>
Hi Li,
lizetao1@huawei.com wrote on Thu, 17 Aug 2023 10:45:05 +0800:
> After the commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for
> prepared and enabled clocks"), it can replace the pair of functions,
> devm_clk_get() and clk_prepare_enable() with a single helper function
> devm_clk_get_enabled(). Moreover, the driver will keeps a clock prepared
> (or enabled) during the whole lifetime of the driver, it is unnecessary to
> unprepare and disable clock explicitly when remove driver or in the error
> handling path. The mtk_nfc_enable_clk() is a helper function that enables
> the "clk->nfi_clk" and "clk->pad_clk", it can be combined into
> devm_clk_get_enabled().
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
> ---
> drivers/mtd/nand/raw/mtk_nand.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
> index b6eb8cb6b5e9..0d185e650aaf 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -1545,40 +1545,36 @@ static int mtk_nfc_probe(struct platform_device *pdev)
> goto release_ecc;
> }
>
> - nfc->clk.nfi_clk = devm_clk_get(dev, "nfi_clk");
> + nfc->clk.nfi_clk = devm_clk_get_enabled(dev, "nfi_clk");
> if (IS_ERR(nfc->clk.nfi_clk)) {
> dev_err(dev, "no clk\n");
> ret = PTR_ERR(nfc->clk.nfi_clk);
> goto release_ecc;
> }
>
> - nfc->clk.pad_clk = devm_clk_get(dev, "pad_clk");
> + nfc->clk.pad_clk = devm_clk_get_enabled(dev, "pad_clk");
> if (IS_ERR(nfc->clk.pad_clk)) {
> dev_err(dev, "no pad clk\n");
> ret = PTR_ERR(nfc->clk.pad_clk);
> goto release_ecc;
> }
>
> - ret = mtk_nfc_enable_clk(dev, &nfc->clk);
> - if (ret)
> - goto release_ecc;
> -
> irq = platform_get_irq(pdev, 0);
> if (irq < 0) {
> ret = -EINVAL;
> - goto clk_disable;
> + goto release_ecc;
> }
>
> ret = devm_request_irq(dev, irq, mtk_nfc_irq, 0x0, "mtk-nand", nfc);
> if (ret) {
> dev_err(dev, "failed to request nfi irq\n");
> - goto clk_disable;
> + goto release_ecc;
> }
>
> ret = dma_set_mask(dev, DMA_BIT_MASK(32));
> if (ret) {
> dev_err(dev, "failed to set dma mask\n");
> - goto clk_disable;
> + goto release_ecc;
> }
>
> platform_set_drvdata(pdev, nfc);
> @@ -1586,14 +1582,11 @@ static int mtk_nfc_probe(struct platform_device *pdev)
> ret = mtk_nfc_nand_chips_init(dev, nfc);
> if (ret) {
> dev_err(dev, "failed to init nand chips\n");
> - goto clk_disable;
> + goto release_ecc;
> }
>
> return 0;
>
> -clk_disable:
> - mtk_nfc_disable_clk(&nfc->clk);
> -
> release_ecc:
> mtk_ecc_release(nfc->ecc);
>
> @@ -1618,7 +1611,6 @@ static void mtk_nfc_remove(struct platform_device *pdev)
> }
>
> mtk_ecc_release(nfc->ecc);
> - mtk_nfc_disable_clk(&nfc->clk);
mtk_nfc_disable_clk() now has a single user, which is the suspend
callback. This callback does nothing else than calling
mtk_nfs_disable_clk(). Can you please drop the helper and just move the
two lines in the suspend function?
> }
>
> #ifdef CONFIG_PM_SLEEP
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-08-17 8:35 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 [this message]
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 ` [PATCH -next v2 03/12] mtd: rawnand: fsmc: Use helper function devm_clk_get_enabled() Li Zetao
2023-08-18 8:11 ` 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=20230817103444.521d087f@xps-13 \
--to=miquel.raynal@bootlin.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=lizetao1@huawei.com \
--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=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;
as well as URLs for NNTP newsgroup(s).