Re: [PATCH RFC v2 2/9] ACPI: Introduce IRQ methods for static fwnodes

From: Rafael J. Wysocki (Intel)

Date: Fri Dec 04 2026 - 13:21:24 EST


On Fri, Dec 4, 2026 at 7:10 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Nov 30, 2026 at 09:54:34AM +0100, Lorenzo Pieralisi wrote:
> > To describe and map GSIs for firmware nodes created out of ACPI static
> > table entries in a uniform way later than at static tables parsing time,
> > it is required to store GSI data (number, trigger/polarity and name) in
> > the ACPI static fwnode for late retrieval.
> >
> > Define an ACPI static fwnode structure and add to it data that can store
> > GSI number/flag/names to describe GSIs and their trigger mode/polarity,
> > and implement irq_get()/property_read_string_array() callbacks for static
> > fwnodes so that core code can retrieve and map IRQs for ACPI static fwnodes
> > in standard manner.
>
> ...
>
> > +static int acpi_static_fwnode_read_string_array(const struct fwnode_handle *fwnode,
> > + const char *propname,
> > + const char **val, size_t nval)
> > +{
> > + const struct acpi_static_fwnode *node = container_of(fwnode,
> > + struct acpi_static_fwnode, fwnode);
>
> I find the following style slightly better to follow
>
> const struct acpi_static_fwnode *node =
> container_of(fwnode, struct acpi_static_fwnode, fwnode);
>
> > + unsigned int i;
>
> > + if (strcmp(propname, "interrupt-names") || !node->irq_count || !node->irqs[0].name)
> > + return -EINVAL;
>
> Okay, so it's stricly limited to IRQs for now.
>
> > + if (!val)
> > + return node->irq_count;
> > +
> > + nval = min_t(size_t, nval, node->irq_count);
>
> Can we avoid _t variant of min() please?
>
> > + for (i = 0; i < nval; i++)
>
> for (size_t i = 0; i < nval; i++)
>
> > + val[i] = node->irqs[i].name;
> > +
> > + return nval;
> > +}
>
> ...
>
> > +struct acpi_static_irq {
> > + u32 gsi;
> > + u8 trigger;
> > + u8 polarity;
> > + const char *name;
> > +};
>
> I see a big potential of reusing this data type elsewhere in the kernel. Can we
> have it somewhere in acpi.h or close enough and name like struct acpi_gsi?

It is defined in acpi.h AFAICS.

I like your suggestion for the name change though.