Re: [PATCH v3 10/12] opp: Support set_opp() customization without requiring to use regulators

From: Viresh Kumar
Date: Mon Jan 18 2021 - 09:07:00 EST


On 18-01-21, 03:55, Dmitry Osipenko wrote:
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index eefd0b15890c..c98fd2add563 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -13,6 +13,7 @@
>
> #include <linux/energy_model.h>
> #include <linux/err.h>
> +#include <linux/kref.h>
> #include <linux/notifier.h>
>
> struct clk;
> @@ -74,6 +75,7 @@ struct dev_pm_opp_info {
> * @regulator_count: Number of regulators
> * @clk: Pointer to clk
> * @dev: Pointer to the struct device
> + * @kref: Reference counter
> *
> * This structure contains all information required for setting an OPP.
> */
> @@ -85,6 +87,7 @@ struct dev_pm_set_opp_data {
> unsigned int regulator_count;
> struct clk *clk;
> struct device *dev;
> + struct kref kref;
> };

Instead of kref thing, allocate the memory for supplies from
dev_pm_opp_set_regulators() and store it in new entries in opp-table
and for rest of the data from dev_pm_opp_register_set_opp_helper(), to
which you can copy supplies pointers then.

--
viresh