Re: [PATCH v1] cpufreq: tegra20: Use resource-managed API
From: Viresh Kumar
Date: Tue Jan 19 2021 - 23:33:25 EST
On 19-01-21, 18:01, Dmitry Osipenko wrote:
> The regular devm_opp_* helpers won't be usable for CPUFreq drivers because OPP is applied to the CPU device and not the device of the CPUFreq driver.
Ahh, I missed that.
> But maybe we could support such cases by the helpers?
> I CC'd Yangtao Li.
> For example we could do this:
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index ca8c6acc29f4..e2eb0f9cf46c 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1771,7 +1771,8 @@ static void devm_pm_opp_supported_hw_release(void *data)
> * devm_pm_opp_set_supported_hw() - Set supported platforms
> - * @dev: Device for which supported-hw has to be set.
> + * @dev: Device which manages allocated resources.
> + * @opp_dev: Device for which supported-hw has to be set.
> * @versions: Array of hierarchy of versions to match.
> * @count: Number of elements in the array.
> @@ -1783,13 +1784,14 @@ static void devm_pm_opp_supported_hw_release(void *data)
> * The opp_table structure will be freed after the device is destroyed.
> struct opp_table *devm_pm_opp_set_supported_hw(struct device *dev,
> + struct device *opp_dev,
> const u32 *versions,
> unsigned int count)
> struct opp_table *opp_table;
> int err;
> - opp_table = dev_pm_opp_set_supported_hw(dev, versions, count);
> + opp_table = dev_pm_opp_set_supported_hw(opp_dev, versions, count);
> if (IS_ERR(opp_table))
> return opp_table;
No please :)