mmc: sdhci-msm: Convert to use resource-managed OPP API
authorYangtao Li <tiny.windzz@gmail.com>
Sun, 14 Mar 2021 16:34:03 +0000 (19:34 +0300)
committerViresh Kumar <viresh.kumar@linaro.org>
Tue, 16 Mar 2021 04:44:11 +0000 (10:14 +0530)
Use resource-managed OPP API to simplify code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/mmc/host/sdhci-msm.c

index 5e1da4d..d170c91 100644 (file)
@@ -264,7 +264,6 @@ struct sdhci_msm_host {
        struct clk_bulk_data bulk_clks[5];
        unsigned long clk_rate;
        struct mmc_host *mmc;
-       struct opp_table *opp_table;
        bool use_14lpp_dll_reset;
        bool tuning_done;
        bool calibration_done;
@@ -2551,17 +2550,15 @@ static int sdhci_msm_probe(struct platform_device *pdev)
        if (ret)
                goto bus_clk_disable;
 
-       msm_host->opp_table = dev_pm_opp_set_clkname(&pdev->dev, "core");
-       if (IS_ERR(msm_host->opp_table)) {
-               ret = PTR_ERR(msm_host->opp_table);
+       ret = devm_pm_opp_set_clkname(&pdev->dev, "core");
+       if (ret)
                goto bus_clk_disable;
-       }
 
        /* OPP table is optional */
-       ret = dev_pm_opp_of_add_table(&pdev->dev);
+       ret = devm_pm_opp_of_add_table(&pdev->dev);
        if (ret && ret != -ENODEV) {
                dev_err(&pdev->dev, "Invalid OPP table in Device tree\n");
-               goto opp_put_clkname;
+               goto bus_clk_disable;
        }
 
        /* Vote for maximum clock rate for maximum performance */
@@ -2587,7 +2584,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
        ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
                                      msm_host->bulk_clks);
        if (ret)
-               goto opp_cleanup;
+               goto bus_clk_disable;
 
        /*
         * xo clock is needed for FLL feature of cm_dll.
@@ -2732,10 +2729,6 @@ pm_runtime_disable:
 clk_disable:
        clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
                                   msm_host->bulk_clks);
-opp_cleanup:
-       dev_pm_opp_of_remove_table(&pdev->dev);
-opp_put_clkname:
-       dev_pm_opp_put_clkname(msm_host->opp_table);
 bus_clk_disable:
        if (!IS_ERR(msm_host->bus_clk))
                clk_disable_unprepare(msm_host->bus_clk);
@@ -2754,8 +2747,6 @@ static int sdhci_msm_remove(struct platform_device *pdev)
 
        sdhci_remove_host(host, dead);
 
-       dev_pm_opp_of_remove_table(&pdev->dev);
-       dev_pm_opp_put_clkname(msm_host->opp_table);
        pm_runtime_get_sync(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
        pm_runtime_put_noidle(&pdev->dev);