[PATCH -next 03/11] mtd: rawnand: fsmc: Use helper function devm_clk_get_enabled()

Miquel Raynal miquel.raynal at bootlin.com
Thu Aug 17 01:31:10 PDT 2023


Hi Li,

lizetao1 at huawei.com wrote on Thu, 17 Aug 2023 10:45:01 +0800:

A few nits for all your commit logs aside from a comment below:

> After the commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for

  Since commit

> prepared and enabled clocks"), it can replace the pair of functions,

			       , 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.

> 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

  Moreover, it is no longer necessary to unprepare and disable the clock
  explicitly.

> unprepare and disable clock explicitly when remove driver or in the error
> handling path.
> 
> Signed-off-by: Li Zetao <lizetao1 at huawei.com>
> ---
>  drivers/mtd/nand/raw/fsmc_nand.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
> index 7b4742420dfc..ab1b9a5c93e9 100644
> --- a/drivers/mtd/nand/raw/fsmc_nand.c
> +++ b/drivers/mtd/nand/raw/fsmc_nand.c

[...]

> @@ -1157,7 +1153,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
>  		dma_release_channel(host->read_dma_chan);
>  disable_clk:

This label no longer makes sense, please rename it to "disable_fsmc" or
something like that.

>  	fsmc_nand_disable(host);
> -	clk_disable_unprepare(host->clk);
>  
>  	return ret;
>  }

Thanks,
Miquèl



More information about the Linux-mediatek mailing list