Re: [PATCH v8 09/26] memory: tegra30: Support interconnect framework
From: Dmitry Osipenko
Date: Wed Nov 11 2020 - 09:08:16 EST
11.11.2020 10:54, Viresh Kumar пишет:
> On 11-11-20, 10:32, Dmitry Osipenko wrote:
>> 11.11.2020 09:18, Viresh Kumar пишет:
>>> On 11-11-20, 09:14, Dmitry Osipenko wrote:
>>>> The dev_pm_opp_of_add_table() will produce a error message which doesn't
>>>> give a clue about what's wrong, i.e. that device-tree needs to be updated.
>>>
>>> If you think that you need to print something more, then you can do
>>> that in the error message you print when dev_pm_opp_of_add_table()
>>> fails. I would suggest to drop this redundant check here.
>>>
>>
>> Please give the rationale.
>
> The rationale is that the check is already performed by
> dev_pm_opp_of_add_table() and it isn't going to add *any* benefit to
> check it again here. Such a check for matching compatible platforms is
> normally fine, but not for this. This is like open coding part of
> dev_pm_opp_of_add_table(), and so is redundant. The
> dev_pm_opp_of_add_table() helper also checks for OPPv1 bindings in the
> DT (yes you won't be using them on your platform) and so relying on
> that API is a better thing to do.
>
> As you already said, you just wanted a better print message and so you
> have added this check. If you really care only about the print
> message, then you can add a print of your choice in the driver but
> otherwise this check is not going to benefit you much I am afraid.
>
> Having said that, this isn't the code I maintain. I need to guarantee
> that the OPP core APIs are used properly and are not misused and so I
> have a higher say there. But in this case all I can do is _suggest_
> and not enforce. And as I said earlier, I suggest to drop this
> redundant check in order to make your code better and faster.
>
> Thanks.
>
I took a closer look and turned out that devm_pm_opp_of_add_table()
silently returns -ENODEV if OPP is missing in a DT. Hence indeed it
should be good to drop the property-check. I'll improve it in the next
revision, thank you.