Re: [PATCH 2/2] OPP: ti: Use devm_pm_opp_set_config_regulators

From: Viresh Kumar
Date: Mon Jun 10 2024 - 00:23:03 EST


Hi Primoz,

Thanks for your changes, they look exactly as we discussed earlier, but ..

On 06-06-24, 13:33, Primoz Fiser wrote:
> Function ti_opp_supply_probe() since commit 6baee034cb55 ("OPP: ti:
> Migrate to dev_pm_opp_set_config_regulators()") returns wrong values
> when all goes well and hence driver probing eventually fails.
>
> Switch to using devm_pm_opp_set_config_regulators() function that
> correctly handles return values and doesn't require us to handle
> returned tokens.
>
> Fixes: 6baee034cb55 ("OPP: ti: Migrate to dev_pm_opp_set_config_regulators()")
> Signed-off-by: Primoz Fiser <primoz.fiser@xxxxxxxxx>
> ---
> drivers/opp/ti-opp-supply.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c
> index e3b97cd1fbbf..8a4bcc5fb9dc 100644
> --- a/drivers/opp/ti-opp-supply.c
> +++ b/drivers/opp/ti-opp-supply.c
> @@ -392,7 +392,7 @@ static int ti_opp_supply_probe(struct platform_device *pdev)
> return ret;
> }
>
> - ret = dev_pm_opp_set_config_regulators(cpu_dev, ti_opp_config_regulators);
> + ret = devm_pm_opp_set_config_regulators(cpu_dev, ti_opp_config_regulators);
> if (ret < 0)
> _free_optimized_voltages(dev, &opp_data);

-- I made a mistake.

The driver gets probed with a platform device, while
devm_pm_opp_set_config_regulators() works with cpu device. And so the
issue related to module insertion/removal/insertion will still be
there :(.

Did you try that though ?

The only way to get this solved is probably by introducing a remove()
method, which clears the OPP config and stores the token returned by
dev_pm_opp_set_config_regulators().

--
viresh