Re: [RFC PATCH] of: platform: Skip mapping of interrupts in of_device_alloc()

From: Lad, Prabhakar
Date: Wed Mar 09 2022 - 16:10:00 EST


Hi Marc,

On Thu, Dec 9, 2021 at 10:33 AM Marc Zyngier <maz@xxxxxxxxxx> wrote:
>
> On Thu, 09 Dec 2021 10:00:44 +0000,
> "Lad, Prabhakar" <prabhakar.csengg@xxxxxxxxx> wrote:
> >
> > > The root of the issue is that all the resource allocation is done
> > > upfront, way before we even have a driver that could potentially
> > > deal with this device. This is a potential waste of resource, and
> > > it triggers the issue you noticed.
> > >
> > > If you delay the resource allocation until there is an actual
> > > match with a driver, you could have a per-driver flag telling you
> > > whether the IRQ allocation should be performed before the probe()
> > > function is called.
> > >
> > As suggested by Rob, if we switch the drivers to use
> > platform_get_resource(pdev, IORESOURCE_IRQ, n) call with
> > platform_get_irq() this code should go away and with this switch the
> > resource allocation will happen demand. Is this approach OK?
>
> If you get rid of of_irq_to_resource_table() altogether, then yes,
> this has a fighting chance to work.
>
To clarify, did you mean to get rid of_irq_to_resource_table()
completely or just from the drivers/of/platform.c ([0])?

[0] https://elixir.bootlin.com/linux/latest/source/drivers/of/platform.c#L143

Cheers,
Prabhakar