mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] memory: mtk-smi: Simplify using devm_clk_get_enabled()
@ 2024-08-20 12:34 Rong Qianfeng
  2024-08-20 12:40 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Rong Qianfeng @ 2024-08-20 12:34 UTC (permalink / raw)
  To: Yong Wu, Krzysztof Kozlowski, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-mediatek, linux-kernel,
	linux-arm-kernel
  Cc: opensource.kernel, Rong Qianfeng

devm_clk_get_enabled() will call devm_clk_get() + clk_prepare_enable()
and the clock will automatically be disabled, unprepared and freed when
the device is unbound from the bus. So simplify mtk_smi_common_probe()
accordingly.

Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com>
---
 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] memory: mtk-smi: Simplify using devm_clk_get_enabled()
  2024-08-20 12:34 [PATCH] memory: mtk-smi: Simplify using devm_clk_get_enabled() Rong Qianfeng
@ 2024-08-20 12:40 ` Krzysztof Kozlowski
  2024-08-21  2:02   ` Rong Qianfeng
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-20 12:40 UTC (permalink / raw)
  To: Rong Qianfeng, Yong Wu, Matthias Brugger,
	AngeloGioacchino Del Regno, linux-mediatek, linux-kernel,
	linux-arm-kernel
  Cc: opensource.kernel

On 20/08/2024 14:34, Rong Qianfeng wrote:
> devm_clk_get_enabled() will call devm_clk_get() + clk_prepare_enable()
> and the clock will automatically be disabled, unprepared and freed when
> the device is unbound from the bus. 

That's obvious, drop. You do not have to explain basic APIs. Instead say
what is being simplified here.

> So simplify mtk_smi_common_probe()
> accordingly.

Also explain that you fix bug of missing unprepare in unbind and add
Fixes+CC stable tags.

Best regards,
Krzysztof


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

* Re: [PATCH] memory: mtk-smi: Simplify using devm_clk_get_enabled()
  2024-08-20 12:40 ` Krzysztof Kozlowski
@ 2024-08-21  2:02   ` Rong Qianfeng
  0 siblings, 0 replies; 3+ messages in thread
From: Rong Qianfeng @ 2024-08-21  2:02 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-kernel, linux-arm-kernel,
	linux-mediatek, Rong Qianfeng
  Cc: opensource.kernel, Yong Wu, Matthias Brugger, AngeloGioacchino Del Regno


在 2024/8/20 20:40, Krzysztof Kozlowski 写道:
> [Some people who received this message don't often get email from krzk@kernel.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> On 20/08/2024 14:34, Rong Qianfeng wrote:
>> devm_clk_get_enabled() will call devm_clk_get() + clk_prepare_enable()
>> and the clock will automatically be disabled, unprepared and freed when
>> the device is unbound from the bus.
> That's obvious, drop. You do not have to explain basic APIs. Instead say
> what is being simplified here.
>
>> So simplify mtk_smi_common_probe()
>> accordingly.
> Also explain that you fix bug of missing unprepare in unbind and add
> Fixes+CC stable tags.

OK, thanks for the reminder.

Best regards,

Qianfeng

>
> Best regards,
> Krzysztof
>

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

end of thread, other threads:[~2024-08-21  2:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20 12:34 [PATCH] memory: mtk-smi: Simplify using devm_clk_get_enabled() Rong Qianfeng
2024-08-20 12:40 ` Krzysztof Kozlowski
2024-08-21  2:02   ` Rong Qianfeng

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®