* [PATCH] mmc: meson-gx: use devm_clk_get_enabled() for core clock
@ 2023-02-15 19:58 Heiner Kallweit
2023-02-17 10:56 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2023-02-15 19:58 UTC (permalink / raw)
To: Ulf Hansson, Kevin Hilman, Neil Armstrong, Martin Blumenstingl,
Jerome Brunet
Cc: open list:ARM/Amlogic Meson..., linux-arm-kernel, linux-mmc
Use devm_clk_get_enabled() to simplify the code.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/mmc/host/meson-gx-mmc.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 079c52dbe..6ed95c555 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -155,7 +155,6 @@ struct meson_host {
struct mmc_command *cmd;
void __iomem *regs;
- struct clk *core_clk;
struct clk *mux_clk;
struct clk *mmc_clk;
unsigned long req_rate;
@@ -1166,6 +1165,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
struct resource *res;
struct meson_host *host;
struct mmc_host *mmc;
+ struct clk *core_clk;
int cd_irq, ret;
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(struct meson_host));
@@ -1228,17 +1228,13 @@ static int meson_mmc_probe(struct platform_device *pdev)
host->pins_clk_gate = NULL;
}
- host->core_clk = devm_clk_get(&pdev->dev, "core");
- if (IS_ERR(host->core_clk))
- return PTR_ERR(host->core_clk);
-
- ret = clk_prepare_enable(host->core_clk);
- if (ret)
- return ret;
+ core_clk = devm_clk_get_enabled(&pdev->dev, "core");
+ if (IS_ERR(core_clk))
+ return PTR_ERR(core_clk);
ret = meson_mmc_clk_init(host);
if (ret)
- goto err_core_clk;
+ return ret;
/* set config to sane default */
meson_mmc_cfg_init(host);
@@ -1322,8 +1318,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
free_irq(host->irq, host);
err_init_clk:
clk_disable_unprepare(host->mmc_clk);
-err_core_clk:
- clk_disable_unprepare(host->core_clk);
return ret;
}
@@ -1338,7 +1332,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
free_irq(host->irq, host);
clk_disable_unprepare(host->mmc_clk);
- clk_disable_unprepare(host->core_clk);
return 0;
}
--
2.39.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: meson-gx: use devm_clk_get_enabled() for core clock
2023-02-15 19:58 [PATCH] mmc: meson-gx: use devm_clk_get_enabled() for core clock Heiner Kallweit
@ 2023-02-17 10:56 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2023-02-17 10:56 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Kevin Hilman, Neil Armstrong, Martin Blumenstingl, Jerome Brunet,
open list:ARM/Amlogic Meson...,
linux-arm-kernel, linux-mmc
On Wed, 15 Feb 2023 at 21:01, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Use devm_clk_get_enabled() to simplify the code.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/meson-gx-mmc.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 079c52dbe..6ed95c555 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -155,7 +155,6 @@ struct meson_host {
> struct mmc_command *cmd;
>
> void __iomem *regs;
> - struct clk *core_clk;
> struct clk *mux_clk;
> struct clk *mmc_clk;
> unsigned long req_rate;
> @@ -1166,6 +1165,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
> struct resource *res;
> struct meson_host *host;
> struct mmc_host *mmc;
> + struct clk *core_clk;
> int cd_irq, ret;
>
> mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(struct meson_host));
> @@ -1228,17 +1228,13 @@ static int meson_mmc_probe(struct platform_device *pdev)
> host->pins_clk_gate = NULL;
> }
>
> - host->core_clk = devm_clk_get(&pdev->dev, "core");
> - if (IS_ERR(host->core_clk))
> - return PTR_ERR(host->core_clk);
> -
> - ret = clk_prepare_enable(host->core_clk);
> - if (ret)
> - return ret;
> + core_clk = devm_clk_get_enabled(&pdev->dev, "core");
> + if (IS_ERR(core_clk))
> + return PTR_ERR(core_clk);
>
> ret = meson_mmc_clk_init(host);
> if (ret)
> - goto err_core_clk;
> + return ret;
>
> /* set config to sane default */
> meson_mmc_cfg_init(host);
> @@ -1322,8 +1318,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
> free_irq(host->irq, host);
> err_init_clk:
> clk_disable_unprepare(host->mmc_clk);
> -err_core_clk:
> - clk_disable_unprepare(host->core_clk);
> return ret;
> }
>
> @@ -1338,7 +1332,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
> free_irq(host->irq, host);
>
> clk_disable_unprepare(host->mmc_clk);
> - clk_disable_unprepare(host->core_clk);
>
> return 0;
> }
> --
> 2.39.1
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-17 10:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 19:58 [PATCH] mmc: meson-gx: use devm_clk_get_enabled() for core clock Heiner Kallweit
2023-02-17 10:56 ` Ulf Hansson
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®