ata: use named initializers for acpi_device_id
Subsystems (2)
PATCH v2 1/1 ata: use named initializers for acpi_device_id
Use a named initializer for the acpi_device_id fields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.
While we are at it - unify the list terminator to have a single space between the brackets and no trailing comma.
---
This series is converting lists that contain the acpi_device_id struct, which is defined in the include/linux/device-id/acpi.h to makes use of named initializers (which they do not use currently). This work is part of the on going effort in the kernel associated with device-ids [1]
The plan is to convert acpi_device_id::driver_data to have an anonymous union, similarly to what was introduced for PCI and I2C device ID tables. The goal is to increase type-safety (as most of the existing casts are gone), to improve readability and to make use intent a bit more clear:
```
union {
kernel_ulong_t driver_data;
const void *driver_data_ptr;
}
```But for that to work all lists containing the structs need to use named initializers first. I already have patches that implement this and touching a lot of kernel subsystmes that use the acpi_device_id struct and that list keeps on growing. Therefore, I have decided to split the series per every subsystem into:
- pre-clean-ups that convert the lists to use named initializers (this series)
- actual implementations that make some of the modules use the new driver_data_ptr
That way the task can be fragmented into manageable and independent chunks of work and makes this effort easier to review.
Tested builds on x86-64 in Yocto using 7.2-rc6
---
Changes in v2:
- Fixed up into a single patch
- Link to v1: https://lore.kernel.org/r/[email protected]
To: Hans de Goede <[email protected]>
To: Damien Le Moal <[email protected]>
To: Niklas Cassel <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/ata/ahci_platform.c | 4 ++-- drivers/ata/ahci_qoriq.c | 2 +- drivers/ata/ahci_seattle.c | 4 ++-- drivers/ata/ahci_xgene.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/ata/ahci_platform.c +2 -2
@@ -88,9 +88,9 @@ static const struct of_device_id ahci_of_match[] = {MODULE_DEVICE_TABLE (of, ahci_of_match);static const struct acpi_device_id ahci_acpi_match[] = { - {"APMC0D33" , (unsigned long )&ahci_port_info_nolpm }, + { .id ="APMC0D33" , .driver_data = (unsigned long )&ahci_port_info_nolpm }, {ACPI_DEVICE_CLASS (PCI_CLASS_STORAGE_SATA_AHCI ,0xffffff ) }, - {}, + { } };MODULE_DEVICE_TABLE (acpi, ahci_acpi_match);
drivers/ata/ahci_qoriq.c +1 -1
@@ -80,7 +80,7 @@ static const struct of_device_id ahci_qoriq_of_match[] = {MODULE_DEVICE_TABLE (of, ahci_qoriq_of_match);static const struct acpi_device_id ahci_qoriq_acpi_match[] = { - {"NXP0004" , .driver_data = (kernel_ulong_t )AHCI_LX2160A }, + { .id ="NXP0004" , .driver_data = (kernel_ulong_t )AHCI_LX2160A }, { } };MODULE_DEVICE_TABLE (acpi, ahci_qoriq_acpi_match);
drivers/ata/ahci_seattle.c +2 -2
@@ -178,8 +178,8 @@ static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend, ahci_platform_resume);static const struct acpi_device_id ahci_acpi_match[] = { - {"AMDI0600" ,0 }, - {} + { .id ="AMDI0600" }, + { } };MODULE_DEVICE_TABLE (acpi, ahci_acpi_match);
drivers/ata/ahci_xgene.c +3 -3
@@ -710,9 +710,9 @@ static const struct scsi_host_template ahci_platform_sht = {#ifdef CONFIG_ACPI static const struct acpi_device_id xgene_ahci_acpi_match[] = { - {"APMC0D0D" ,XGENE_AHCI_V1 }, - {"APMC0D32" ,XGENE_AHCI_V2 }, - {}, + { .id ="APMC0D0D" , .driver_data =XGENE_AHCI_V1 }, + { .id ="APMC0D32" , .driver_data =XGENE_AHCI_V2 }, + { } };MODULE_DEVICE_TABLE (acpi, xgene_ahci_acpi_match);#endif
---
base-commit: 9ecfb2f7287a967b418ba69f10d45ead0d360593
change-id: 20260803-ata-acpi-18f405eb03a2
Best regards,
Signature · 1 line
Pawel Zalewski (The Capable Hub) <[email protected]>
Quoted 7 lines · On Tue, Aug 04, 2026 at 10:44:26AM +0100, Pawel Zalewski via B4 Relay wrote:
From: "Pawel Zalewski (The Capable Hub)" <[email protected]>
Use a named initializer for the
acpi_device_idfields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.
Quoted 5 lines
While we are at it - unify the list terminator to have a single space between the brackets and no trailing comma.
Signed-off-by Pawel Zalewski (The Capable Hub) <[email protected]>
Quoted 7 lines · On 8/4/26 18:44, Pawel Zalewski via B4 Relay wrote:
From: "Pawel Zalewski (The Capable Hub)" <[email protected]>
Use a named initializer for the
acpi_device_idfields which makes the code more readable and consistent with how lists are initialized in the rest of the kernel code base. Also drop explicitly setting fields to 0 where it is redundant.
Quoted 5 lines
While we are at it - unify the list terminator to have a single space between the brackets and no trailing comma.
Signed-off-by Pawel Zalewski (The Capable Hub) <[email protected]>
Applied to for-7.3. Thanks!
Signature · 2 lines
Damien Le Moal Western Digital Research