linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] memory: mtk-smi: Use devm_clk_get_enabled()
@ 2024-08-21  3:25 Rong Qianfeng
  2024-08-21  8:01 ` Yong Wu (吴勇)
  2024-08-25 12:22 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: Rong Qianfeng @ 2024-08-21  3:25 UTC (permalink / raw)
  To: Yong Wu, Krzysztof Kozlowski, Matthias Brugger,
	AngeloGioacchino Del Regno, Honghui Zhang, Joerg Roedel,
	linux-mediatek, linux-kernel, linux-arm-kernel
  Cc: opensource.kernel, Rong Qianfeng

Replace devm_clk_get() and clk_prepare_enable() with
devm_clk_get_enabled() in .probe().

Fix the bug of missing clk_disable_unprepare() in .remove() by 
using devm_clk_get_enabled() that can disables and unprepares 
it automatically on driver detach.

Fixes: 3c8f4ad85c4b ("memory/mediatek: add support for mt2701")
Cc: honghui.zhang@mediatek.com
Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com>
---
Version 2 changes:
1. Modified the patch description as suggested by Krzysztof.

 drivers/memory/mtk-smi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index fbe52ecc0eca..2bc034dff691 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -771,13 +771,9 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
 		if (IS_ERR(common->smi_ao_base))
 			return PTR_ERR(common->smi_ao_base);
 
-		common->clk_async = devm_clk_get(dev, "async");
+		common->clk_async = devm_clk_get_enabled(dev, "async");
 		if (IS_ERR(common->clk_async))
 			return PTR_ERR(common->clk_async);
-
-		ret = clk_prepare_enable(common->clk_async);
-		if (ret)
-			return ret;
 	} else {
 		common->base = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(common->base))
-- 
2.39.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] memory: mtk-smi: Use devm_clk_get_enabled()
  2024-08-21  3:25 [PATCH v2] memory: mtk-smi: Use devm_clk_get_enabled() Rong Qianfeng
@ 2024-08-21  8:01 ` Yong Wu (吴勇)
  2024-08-25 12:22 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Yong Wu (吴勇) @ 2024-08-21  8:01 UTC (permalink / raw)
  To: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	krzk@kernel.org, honghui.zhang@mediatek.com, jroedel@suse.de,
	linux-arm-kernel@lists.infradead.org, rongqianfeng@vivo.com,
	matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com
  Cc: opensource.kernel@vivo.com

On Wed, 2024-08-21 at 11:25 +0800, Rong Qianfeng wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Replace devm_clk_get() and clk_prepare_enable() with
> 
> devm_clk_get_enabled() in .probe().
> 
> 
> 
> Fix the bug of missing clk_disable_unprepare() in .remove() by 
> 
> using devm_clk_get_enabled() that can disables and unprepares 
> 
> it automatically on driver detach.
> 
> 
> Fixes: 3c8f4ad85c4b ("memory/mediatek: add support for mt2701")
> 
> Cc: honghui.zhang@mediatek.com
> 
> Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com>

Reviewed-by: Yong Wu <yong.wu@mediatek.com>

> ---
> 
> Version 2 changes:
> 
> 1. Modified the patch description as suggested by Krzysztof.
> 
> 
>  drivers/memory/mtk-smi.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index fbe52ecc0eca..2bc034dff691 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -771,13 +771,9 @@ static int mtk_smi_common_probe(struct
> platform_device *pdev)
>  		if (IS_ERR(common->smi_ao_base))
>  			return PTR_ERR(common->smi_ao_base);
>  
> -		common->clk_async = devm_clk_get(dev, "async");
> +		common->clk_async = devm_clk_get_enabled(dev, "async");
>  		if (IS_ERR(common->clk_async))
>  			return PTR_ERR(common->clk_async);
> -
> -		ret = clk_prepare_enable(common->clk_async);
> -		if (ret)
> -			return ret;
>  	} else {
>  		common->base = devm_platform_ioremap_resource(pdev, 0);
>  		if (IS_ERR(common->base))
> -- 
> 2.39.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] memory: mtk-smi: Use devm_clk_get_enabled()
  2024-08-21  3:25 [PATCH v2] memory: mtk-smi: Use devm_clk_get_enabled() Rong Qianfeng
  2024-08-21  8:01 ` Yong Wu (吴勇)
@ 2024-08-25 12:22 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-25 12:22 UTC (permalink / raw)
  To: Yong Wu, Krzysztof Kozlowski, Matthias Brugger,
	AngeloGioacchino Del Regno, Honghui Zhang, Joerg Roedel,
	linux-mediatek, linux-kernel, linux-arm-kernel, Rong Qianfeng
  Cc: opensource.kernel


On Wed, 21 Aug 2024 11:25:57 +0800, Rong Qianfeng wrote:
> Replace devm_clk_get() and clk_prepare_enable() with
> devm_clk_get_enabled() in .probe().
> 
> Fix the bug of missing clk_disable_unprepare() in .remove() by
> using devm_clk_get_enabled() that can disables and unprepares
> it automatically on driver detach.
> 
> [...]

Applied, thanks!

[1/1] memory: mtk-smi: Use devm_clk_get_enabled()
      https://git.kernel.org/krzk/linux-mem-ctrl/c/ff390189b7f2cfa20c644bc58b4462b5e2621838

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-25 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21  3:25 [PATCH v2] memory: mtk-smi: Use devm_clk_get_enabled() Rong Qianfeng
2024-08-21  8:01 ` Yong Wu (吴勇)
2024-08-25 12:22 ` Krzysztof Kozlowski

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