Re: [PATCH v2 1/1] serial: sh-sci: Respect deferred probe when getting IRQ

From: Andy Shevchenko
Date: Wed Apr 07 2021 - 09:39:21 EST


On Wed, Apr 07, 2021 at 06:11:46AM -0700, Guenter Roeck wrote:
> On 4/7/21 3:17 AM, Andy Shevchenko wrote:
> > With platform_get_irq() and its optional variant it's possible to get
> > a deferred probe error code. Since the commit ed7027fdf4ec ("driver core:
> > platform: Make platform_get_irq_optional() optional") the error code
> > can be distinguished from no IRQ case. With this, rewrite IRQ resource
> > handling in sh-sci driver to follow above and allow to respect deferred
> > probe.
> >
> > Fixes: ed7027fdf4ec ("driver core: platform: Make platform_get_irq_optional() optional")
> > Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>
> This patch alone causes a hard hang early during boot. It works if applied
> together with ed7027fdf4ec. Ultimately that means that ed7027fdf4ec introduces
> a functional change, and will need to be applied very carefully. A cursory
> glance through callers of platform_get_irq_optional() shows that many
> do not handle this correctly: various drivers handle a return value of 0
> as valid interrupt, and others treat errors other than -ENXIO as fatal.
>
> Also, each patch on its own causes failures on sh, which is problematic
> when applying them even as series. See below for an idea how to
> address that.

Right, that's why I think I have to slow down with it (as I answered to Greg).

> Since sh never gets -EPROBE_DEFER, the following code can be applied
> on its own and does not depend on ed7027fdf4ec.
>
> sci_port->irqs[i] = platform_get_irq_optional(dev, i);
> if (sci_port->irqs[i] <= 0)
> sci_port->irqs[i] = sci_port->irqs[0];
>
> With this change, sh images boot in qemu both with and without ed7027fdf4ec.

Yeah, thanks! But I think we still can avoid double loops there.

--
With Best Regards,
Andy Shevchenko