Re: [PATCH V3 10/20] OPP: Migrate set-regulators API to use set-config helpers

From: Chanwoo Choi
Date: Thu Jul 07 2022 - 15:30:04 EST


On 22. 7. 4. 21:07, Viresh Kumar wrote:
> Now that we have a central API to handle all OPP table configurations,
> migrate the set-regulators family of helpers to use the new
> infrastructure.
>
> The return type and parameter to the APIs change a bit due to this,
> update the current users as well in the same commit in order to avoid
> breaking builds.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
> drivers/cpufreq/cpufreq-dt.c | 12 ++---
> drivers/devfreq/exynos-bus.c | 19 +++-----
> drivers/opp/core.c | 91 ++++++++----------------------------
> include/linux/pm_opp.h | 44 ++++++++++-------
> 4 files changed, 60 insertions(+), 106 deletions(-)
>

(snip)

> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 541baff93ee8..d1235242367f 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -33,7 +33,7 @@ struct exynos_bus {
>
> unsigned long curr_freq;
>
> - struct opp_table *opp_table;
> + int opp_token;
> struct clk *clk;
> unsigned int ratio;
> };
> @@ -161,8 +161,7 @@ static void exynos_bus_exit(struct device *dev)
>
> dev_pm_opp_of_remove_table(dev);
> clk_disable_unprepare(bus->clk);
> - dev_pm_opp_put_regulators(bus->opp_table);
> - bus->opp_table = NULL;
> + dev_pm_opp_put_regulators(bus->opp_token);
> }
>
> static void exynos_bus_passive_exit(struct device *dev)
> @@ -179,18 +178,16 @@ static int exynos_bus_parent_parse_of(struct device_node *np,
> struct exynos_bus *bus)
> {
> struct device *dev = bus->dev;
> - struct opp_table *opp_table;
> const char *supplies[] = { "vdd", NULL };
> int i, ret, count, size;
>
> - opp_table = dev_pm_opp_set_regulators(dev, supplies);
> - if (IS_ERR(opp_table)) {
> - ret = PTR_ERR(opp_table);
> + ret = dev_pm_opp_set_regulators(dev, supplies);
> + if (ret < 0) {
> dev_err(dev, "failed to set regulators %d\n", ret);
> return ret;
> }
>
> - bus->opp_table = opp_table;
> + bus->opp_token = ret;
>
> /*
> * Get the devfreq-event devices to get the current utilization of
> @@ -236,8 +233,7 @@ static int exynos_bus_parent_parse_of(struct device_node *np,
> return 0;
>
> err_regulator:
> - dev_pm_opp_put_regulators(bus->opp_table);
> - bus->opp_table = NULL;
> + dev_pm_opp_put_regulators(bus->opp_token);
>
> return ret;
> }
> @@ -459,8 +455,7 @@ static int exynos_bus_probe(struct platform_device *pdev)
> dev_pm_opp_of_remove_table(dev);
> clk_disable_unprepare(bus->clk);
> err_reg:
> - dev_pm_opp_put_regulators(bus->opp_table);
> - bus->opp_table = NULL;
> + dev_pm_opp_put_regulators(bus->opp_token);
>
> return ret;
> }

Reviewed-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>

Thanks.


(snip)


--
Best Regards,
Samsung Electronics
Chanwoo Choi