Re: [PATCH v1 11/20] gpio: Use named initializers for acpi_device_id array

From: Andy Shevchenko

Date: Tue Jul 14 2026 - 04:29:17 EST


On Tue, Jul 14, 2026 at 09:24:12AM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> While being less compact, using named initializers allows to more easily
> see which members of the structs are assigned which value without having
> to lookup the declaration of the struct. And it's also more robust
> against changes to the struct definition.
>
> The mentioned robustness is relevant for a planned change to struct
> acpi_device_id that replaces .driver_data by an anonymous union.
>
> This patch doesn't modify the compiled arrays, only their representation
> in source form benefits.

...

> +++ b/drivers/gpio/gpio-dwapb.c

> static const struct acpi_device_id dwapb_acpi_match[] = {
> - {"HISI0181", GPIO_REG_OFFSET_V1},
> - {"APMC0D07", GPIO_REG_OFFSET_V1},
> - {"APMC0D81", GPIO_REG_OFFSET_V2},
> - {"FUJI200A", GPIO_REG_OFFSET_V1},
> - {"LECA0001", GPIO_REG_OFFSET_V1},
> + { .id = "HISI0181", .driver_data = GPIO_REG_OFFSET_V1 },
> + { .id = "APMC0D07", .driver_data = GPIO_REG_OFFSET_V1 },
> + { .id = "APMC0D81", .driver_data = GPIO_REG_OFFSET_V2 },
> + { .id = "FUJI200A", .driver_data = GPIO_REG_OFFSET_V1 },
> + { .id = "LECA0001", .driver_data = GPIO_REG_OFFSET_V1 },

While at it, sort them alphabetically by ID.
Please, check all your patches for the same opportunity.

{ .id = "APMC0D07", .driver_data = GPIO_REG_OFFSET_V1 },
{ .id = "APMC0D81", .driver_data = GPIO_REG_OFFSET_V2 },
{ .id = "FUJI200A", .driver_data = GPIO_REG_OFFSET_V1 },
{ .id = "HISI0181", .driver_data = GPIO_REG_OFFSET_V1 },
{ .id = "LECA0001", .driver_data = GPIO_REG_OFFSET_V1 },

> { }
> };

--
With Best Regards,
Andy Shevchenko