Skip to content

Commit 4c4fe4f

Browse files
hkallweitstorulf
authored andcommitted
mmc: meson-gx: use devm_clk_get_enabled() for core clock
Use devm_clk_get_enabled() to simplify the code. Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 71d0453 commit 4c4fe4f

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

drivers/mmc/host/meson-gx-mmc.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ struct meson_host {
155155
struct mmc_command *cmd;
156156

157157
void __iomem *regs;
158-
struct clk *core_clk;
159158
struct clk *mux_clk;
160159
struct clk *mmc_clk;
161160
unsigned long req_rate;
@@ -1166,6 +1165,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
11661165
struct resource *res;
11671166
struct meson_host *host;
11681167
struct mmc_host *mmc;
1168+
struct clk *core_clk;
11691169
int cd_irq, ret;
11701170

11711171
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(struct meson_host));
@@ -1228,17 +1228,13 @@ static int meson_mmc_probe(struct platform_device *pdev)
12281228
host->pins_clk_gate = NULL;
12291229
}
12301230

1231-
host->core_clk = devm_clk_get(&pdev->dev, "core");
1232-
if (IS_ERR(host->core_clk))
1233-
return PTR_ERR(host->core_clk);
1234-
1235-
ret = clk_prepare_enable(host->core_clk);
1236-
if (ret)
1237-
return ret;
1231+
core_clk = devm_clk_get_enabled(&pdev->dev, "core");
1232+
if (IS_ERR(core_clk))
1233+
return PTR_ERR(core_clk);
12381234

12391235
ret = meson_mmc_clk_init(host);
12401236
if (ret)
1241-
goto err_core_clk;
1237+
return ret;
12421238

12431239
/* set config to sane default */
12441240
meson_mmc_cfg_init(host);
@@ -1322,8 +1318,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
13221318
free_irq(host->irq, host);
13231319
err_init_clk:
13241320
clk_disable_unprepare(host->mmc_clk);
1325-
err_core_clk:
1326-
clk_disable_unprepare(host->core_clk);
13271321
return ret;
13281322
}
13291323

@@ -1338,7 +1332,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
13381332
free_irq(host->irq, host);
13391333

13401334
clk_disable_unprepare(host->mmc_clk);
1341-
clk_disable_unprepare(host->core_clk);
13421335

13431336
return 0;
13441337
}

0 commit comments

Comments
 (0)