On 2/24/22 09:42, Viresh Kumar wrote:
> On 24-02-22, 09:33, Lukasz Luba wrote:
>> On 2/24/22 09:13, Viresh Kumar wrote:
>>> On 24-02-22, 08:11, Lukasz Luba wrote:
>>>> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
>
>>>> +static bool _of_has_opp_microwatt_property(struct device *dev)
>>>> +{
>>>> + unsigned long power, freq = 0;
>>>> + struct dev_pm_opp *opp;
>>>> +
>>>> + /* Check if at least one OPP has needed property */
>>>> + opp = dev_pm_opp_find_freq_ceil(dev, &freq);
>>>> + if (IS_ERR(opp))
>>>> + return false;
>>>> +
>>>> + power = dev_pm_opp_get_power(opp);
>>>> + dev_pm_opp_put(opp);
>>>> + if (!power)
>>>
>>> Instead of this heavy stuff, just pick the first OPP from the opp
>>> table and see its power-value.
>>
>> It is the first opp: freq=0.
>> You mean by parsing the the DT node instead, like I had in v2 version?
>
> No, I was thinking if you can simply do:
>
> opp = list_first_entry(&opp_table->opp_list, struct dev_pm_opp, node);
>
> But that requires locking, etc as well. So maybe this is fine.
>
OK, so I'll leave it as is now.
Thank you for the comments. I'll work on v4