[PATCH] ASoC: Intel: atom: Remove redundant check to simplify the code

Andy Shevchenko andriy.shevchenko at linux.intel.com
Mon Nov 29 20:01:16 CET 2021


On Mon, Nov 29, 2021 at 05:11:52PM +0000, Mark Brown wrote:
> On Mon, Nov 29, 2021 at 10:22:41AM -0600, Pierre-Louis Bossart wrote:
> > On 11/25/21 1:50 AM, Tang Bin wrote:
> 
> > > In the function sst_platform_get_resources(), if platform_get_irq()
> > > failed, the return should not be zero, as the example in
> > > platform.c is
> > >   * int irq = platform_get_irq(pdev, 0)
> > >   * if (irq < 0)
> > >   * return irq;
> > > So remove the redundant check to simplify the code.
> 
> > Humm, it's a bit of a gray area.
> 
> > the comments for platform_get_irq and platform_get_irq_optional say:
> 
> > * Return: non-zero IRQ number on success, negative error number on failure.
> 
> > but if you look at platform_get_irq_optional, there are two references
> > to zero being a possible return value:
> 
> Zero is (or was, people were working on changing it partly due to
> confusion and partly due to moving to newer infrastructure which
> doesn't use it) a valid IRQ on some architectures.  x86 wasn't one of
> those though, at least AFAIR.

I guess it's about x86, but the API returns Linux virtual IRQ and 0 shouldn't
be among them (hardware IRQ != Linux virtual IRQ). Legacy x86 used 1:1 mapping
for ISA IRQs (lower 16) among which the Timer IRQ is 0. I believe that timer
code does not use any of those APIs (it most likely and IIRC has it hardcoded).

Nevertheless, I have planned to make platform_irq_get_optional() to be optional
indeed, where we return 0 when there is no IRQ provided and error when it's a
real error happens. This needs to clean up the current (mis-)use of the API.

-- 
With Best Regards,
Andy Shevchenko




More information about the Alsa-devel mailing list