Skip to content

Commit c0184b2

Browse files
xdarklightUlf Hansson
authored andcommitted
mmc: meson-mx-sdio: Use devm_clk_get_enabled()
This simplifies the code. No functional changes intended. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 59472e8 commit c0184b2

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

drivers/mmc/host/meson-mx-sdio.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ struct meson_mx_mmc_host {
103103
struct device *controller_dev;
104104

105105
struct clk *parent_clk;
106-
struct clk *core_clk;
107106
struct clk_divider cfg_div;
108107
struct clk *cfg_div_clk;
109108
struct clk_fixed_factor fixed_factor;
@@ -627,6 +626,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
627626
struct platform_device *slot_pdev;
628627
struct mmc_host *mmc;
629628
struct meson_mx_mmc_host *host;
629+
struct clk *core_clk;
630630
void __iomem *base;
631631
int ret, irq;
632632
u32 conf;
@@ -676,9 +676,9 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
676676
if (ret)
677677
goto error_free_mmc;
678678

679-
host->core_clk = devm_clk_get(host->controller_dev, "core");
680-
if (IS_ERR(host->core_clk)) {
681-
ret = PTR_ERR(host->core_clk);
679+
core_clk = devm_clk_get_enabled(host->controller_dev, "core");
680+
if (IS_ERR(core_clk)) {
681+
ret = PTR_ERR(core_clk);
682682
goto error_free_mmc;
683683
}
684684

@@ -692,16 +692,10 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
692692
if (ret)
693693
goto error_free_mmc;
694694

695-
ret = clk_prepare_enable(host->core_clk);
696-
if (ret) {
697-
dev_err(host->controller_dev, "Failed to enable core clock\n");
698-
goto error_free_mmc;
699-
}
700-
701695
ret = clk_prepare_enable(host->cfg_div_clk);
702696
if (ret) {
703697
dev_err(host->controller_dev, "Failed to enable MMC clock\n");
704-
goto error_disable_core_clk;
698+
goto error_free_mmc;
705699
}
706700

707701
conf = 0;
@@ -715,14 +709,12 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
715709

716710
ret = meson_mx_mmc_add_host(host);
717711
if (ret)
718-
goto error_disable_clks;
712+
goto error_disable_div_clk;
719713

720714
return 0;
721715

722-
error_disable_clks:
716+
error_disable_div_clk:
723717
clk_disable_unprepare(host->cfg_div_clk);
724-
error_disable_core_clk:
725-
clk_disable_unprepare(host->core_clk);
726718
error_free_mmc:
727719
mmc_free_host(mmc);
728720
error_unregister_slot_pdev:
@@ -742,7 +734,6 @@ static void meson_mx_mmc_remove(struct platform_device *pdev)
742734
of_platform_device_destroy(slot_dev, NULL);
743735

744736
clk_disable_unprepare(host->cfg_div_clk);
745-
clk_disable_unprepare(host->core_clk);
746737

747738
mmc_free_host(host->mmc);
748739
}

0 commit comments

Comments
 (0)