linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: opp: Modify opp API, dev_pm_opp_get_freq(), find freq in opp, even it is disabled
       [not found] <1595235326-6333-1-git-send-email-andrew-sh.cheng@mediatek.com>
@ 2020-07-20  9:57 ` Viresh Kumar
       [not found] ` <159531934722.3847286.14813407062714740461@swboyd.mtv.corp.google.com>
  1 sibling, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2020-07-20  9:57 UTC (permalink / raw)
  To: Andrew-sh.Cheng
  Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, Matthias Brugger,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek,
	srv_heupstream

On 20-07-20, 16:55, Andrew-sh.Cheng wrote:
> From: "Andrew-sh.Cheng" <andrew-sh.cheng@mediatek.com>
> 
> Modify dev_pm_opp_get_freq() to return freqeuncy
> even this opp item is not available.
> So that we can get the information of disable opp items.
> 
> Signed-off-by: Andrew-sh.Cheng <andrew-sh.cheng@mediatek.com>
> ---
>  drivers/opp/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index eed42d6b2e6b..5213e0462382 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage);
>   */
>  unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
>  {
> -	if (IS_ERR_OR_NULL(opp) || !opp->available) {
> +	if (IS_ERR_OR_NULL(opp)) {
>  		pr_err("%s: Invalid parameters\n", __func__);
>  		return 0;
>  	}

Applied. Thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: opp: Modify opp API, dev_pm_opp_get_freq(), find freq in opp, even it is disabled
       [not found] ` <159531934722.3847286.14813407062714740461@swboyd.mtv.corp.google.com>
@ 2020-07-21  8:21   ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2020-07-21  8:21 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Andrew-sh.Cheng, Matthias Brugger, Nishanth Menon, Viresh Kumar,
	linux-arm-kernel, linux-kernel, linux-mediatek, linux-pm,
	srv_heupstream

On 21-07-20, 01:15, Stephen Boyd wrote:
> Quoting Andrew-sh.Cheng (2020-07-20 01:55:26)
> > From: "Andrew-sh.Cheng" <andrew-sh.cheng@mediatek.com>
> > 
> > Modify dev_pm_opp_get_freq() to return freqeuncy
> > even this opp item is not available.
> > So that we can get the information of disable opp items.
> > 
> > Signed-off-by: Andrew-sh.Cheng <andrew-sh.cheng@mediatek.com>
> > ---
> >  drivers/opp/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> > index eed42d6b2e6b..5213e0462382 100644
> > --- a/drivers/opp/core.c
> > +++ b/drivers/opp/core.c
> > @@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_voltage);
> >   */
> >  unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
> >  {
> > -       if (IS_ERR_OR_NULL(opp) || !opp->available) {
> > +       if (IS_ERR_OR_NULL(opp)) {
> 
> I wonder why we even have this check. Seems like the caller deserves an
> oops in this case instead of a small pr_err().

I think the reason is same as to why multiple subsystems do similar checks.
While many of them don't do anything if they get a NULL pointer and simply
return, which is fine to support cases where NULL is passed.

But I do agree that maybe we may want to make sure opp-table or opp pointers
passed are all valid all the time and so just remove these checks and let them
crash.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-21  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1595235326-6333-1-git-send-email-andrew-sh.cheng@mediatek.com>
2020-07-20  9:57 ` opp: Modify opp API, dev_pm_opp_get_freq(), find freq in opp, even it is disabled Viresh Kumar
     [not found] ` <159531934722.3847286.14813407062714740461@swboyd.mtv.corp.google.com>
2020-07-21  8:21   ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).