Re: [PATCH] cpufreq: qcom-hw: Use optional irq API

From: Andy Shevchenko
Date: Sat Dec 25 2021 - 11:38:05 EST


On Mon, Dec 6, 2021 at 5:26 PM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> On 16-11-21, 18:03, Stephen Boyd wrote:
> > Use platform_get_irq_optional() to avoid a noisy error message when the
> > irq isn't specified. The irq is definitely optional given that we only
> > care about errors that are -EPROBE_DEFER here.

> > + data->throttle_irq = platform_get_irq_optional(pdev, index);
> > + if (data->throttle_irq == -ENXIO)
> > + return 0;
> > + if (data->throttle_irq < 0)
> > + return data->throttle_irq;

This adds more work for the future.
The best approach is

ret = platform_get_irq_optional(...);
if (ret < 0 && ret != -ENXIO)
return ret;
if (ret > 0)
...we got it...

It will allow the future API fix of platform_get_irq_optional() to be
really optional.

--
With Best Regards,
Andy Shevchenko