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

From: Andy Shevchenko

Date: Fri Dec 04 2026 - 13:14:16 EST


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?

--
With Best Regards,
Andy Shevchenko