ata: Consistently define pci_device_ids using named initializers
Subsystems (2)
v3 cover ata: Consistently define pci_device_ids using named initializers
Hello,
changes since v2 from earlier today
(https://lore.kernel.org/linux-ide/[email protected])
is only rewrapping the pci_device_id in drivers/ata/pata_pdc2027x.c, drivers/ata/pata_serverworks.c, drivers/ata/sata_nv.c, drivers/ata/sata_sis.c and drivers/ata/sata_via.c to keep below 81 chars per line. This only affects patch #2. So I added Damien's Reviewed-by:
tag for the unchanged patch #1.
Best regards
Uwe
Uwe Kleine-König (The Capable Hub) (2):
ata: Drop unused assignments of pci_device_id driver data
ata: Use named initializers for pci_device_id arrays
drivers/ata/acard-ahci.c | 8 +- drivers/ata/ahci.c | 1626 ++++++++++++++++++++++++------- drivers/ata/ata_piix.c | 532 ++++++---- drivers/ata/pata_acpi.c | 5 +- drivers/ata/pata_amd.c | 88 +- drivers/ata/pata_artop.c | 11 +- drivers/ata/pata_atp867x.c | 6 +- drivers/ata/pata_cmd640.c | 4 +- drivers/ata/pata_cmd64x.c | 11 +- drivers/ata/pata_jmicron.c | 7 +- drivers/ata/pata_macio.c | 12 +- drivers/ata/pata_ninja32.c | 14 +- drivers/ata/pata_opti.c | 7 +- drivers/ata/pata_pdc2027x.c | 30 +- drivers/ata/pata_pdc202xx_old.c | 13 +- drivers/ata/pata_sch.c | 2 +- drivers/ata/pata_serverworks.c | 24 +- drivers/ata/pata_sis.c | 1 - drivers/ata/pata_via.c | 19 +- drivers/ata/pdc_adma.c | 3 +- drivers/ata/sata_mv.c | 34 +- drivers/ata/sata_nv.c | 58 +- drivers/ata/sata_promise.c | 34 +- drivers/ata/sata_qstor.c | 3 +- drivers/ata/sata_sil.c | 15 +- drivers/ata/sata_sil24.c | 15 +- drivers/ata/sata_sis.c | 32 +- drivers/ata/sata_svw.c | 15 +- drivers/ata/sata_sx4.c | 3 +- drivers/ata/sata_uli.c | 7 +- drivers/ata/sata_via.c | 38 +- drivers/ata/sata_vsc.c | 14 +- 32 files changed, 1965 insertions(+), 726 deletions(-)
base-commit: abe651837cb394f76d738a7a747322fca3bf17ba
Signature · 1 line
2.47.3
PATCH v3 1/2 ata: Drop unused assignments of pci_device_id driver data
The drivers explicitly set the .driver_data member of struct pci_device_id to zero without relying on that value. Drop these unused assignments.
While touching these arrays, convert the one driver not using PCI_DEVICE to use that macro and align the array's coding style to what is used most for these. (i.e. break very long lines, a single space in the list terminator and no trailing comma.)
This patch doesn't modify the compiled array, only its representation in source form benefits. The former was confirmed with builds on x86 and arm64.
--- drivers/ata/pata_atp867x.c | 6 +++--- drivers/ata/pata_cmd640.c | 4 ++-- drivers/ata/pata_jmicron.c | 7 +++++-- drivers/ata/pata_macio.c | 12 ++++++------ drivers/ata/pata_ninja32.c | 14 +++++++------- drivers/ata/pata_sch.c | 2 +- drivers/ata/sata_vsc.c | 14 +++++++++----- 7 files changed, 33 insertions(+), 26 deletions(-)
drivers/ata/pata_atp867x.c +3 -3
@@ -526,9 +526,9 @@ static int atp867x_reinit_one(struct pci_dev *pdev)#endif static const struct pci_device_id atp867x_pci_tbl[] = { - {PCI_VDEVICE (ARTOP ,PCI_DEVICE_ID_ARTOP_ATP867A ),0 }, - {PCI_VDEVICE (ARTOP ,PCI_DEVICE_ID_ARTOP_ATP867B ),0 }, - { }, + {PCI_VDEVICE (ARTOP ,PCI_DEVICE_ID_ARTOP_ATP867A ) }, + {PCI_VDEVICE (ARTOP ,PCI_DEVICE_ID_ARTOP_ATP867B ) }, + { } };static struct pci_driver atp867x_driver = {
drivers/ata/pata_cmd640.c +2 -2
@@ -248,8 +248,8 @@ static int cmd640_reinit_one(struct pci_dev *pdev)#endif static const struct pci_device_id cmd640[] = { - {PCI_VDEVICE (CMD ,0x640 ),0 }, - { }, + {PCI_VDEVICE (CMD ,0x0640 ) }, + { } };static struct pci_driver cmd640_pci_driver = {
drivers/ata/pata_jmicron.c +5 -2
@@ -148,8 +148,11 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i }static const struct pci_device_id jmicron_pci_tbl[] = { - {PCI_VENDOR_ID_JMICRON ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_ANY_ID , -PCI_CLASS_STORAGE_IDE <<8 ,0xffff00 ,0 }, + { +PCI_DEVICE (PCI_VENDOR_ID_JMICRON ,PCI_ANY_ID ), + .class =PCI_CLASS_STORAGE_IDE <<8 , + .class_mask =0xffff00 + }, { }/* terminate list */ };
drivers/ata/pata_macio.c +6 -6
@@ -1368,12 +1368,12 @@ static struct macio_driver pata_macio_driver = };static const struct pci_device_id pata_macio_pci_match[] = { - {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_UNI_N_ATA ),0 }, - {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_IPID_ATA100 ),0 }, - {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_K2_ATA100 ),0 }, - {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_SH_ATA ),0 }, - {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_IPID2_ATA ),0 }, - {}, + {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_UNI_N_ATA ) }, + {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_IPID_ATA100 ) }, + {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_K2_ATA100 ) }, + {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_SH_ATA ) }, + {PCI_VDEVICE (APPLE ,PCI_DEVICE_ID_APPLE_IPID2_ATA ) }, + { } };static struct pci_driver pata_macio_pci_driver = {
drivers/ata/pata_ninja32.c +7 -7
@@ -166,13 +166,13 @@ static int ninja32_reinit_one(struct pci_dev *pdev)#endif static const struct pci_device_id ninja32[] = { - {0x10FC ,0x0003 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, - {0x1145 ,0x8008 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, - {0x1145 ,0xf008 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, - {0x1145 ,0xf021 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, - {0x1145 ,0xf024 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, - {0x1145 ,0xf02C ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, - { }, + {PCI_DEVICE (0x10FC ,0x0003 ) }, + {PCI_DEVICE (0x1145 ,0x8008 ) }, + {PCI_DEVICE (0x1145 ,0xf008 ) }, + {PCI_DEVICE (0x1145 ,0xf021 ) }, + {PCI_DEVICE (0x1145 ,0xf024 ) }, + {PCI_DEVICE (0x1145 ,0xf02C ) }, + { } };static struct pci_driver ninja32_pci_driver = {
drivers/ata/pata_sch.c +1 -1
@@ -42,7 +42,7 @@ static void sch_set_dmamode(struct ata_port *ap, struct ata_device *adev);static const struct pci_device_id sch_pci_tbl[] = {/* Intel SCH PATA Controller */ - {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_SCH_IDE ),0 }, + {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_INTEL_SCH_IDE ) }, { }/* terminate list */ };
drivers/ata/sata_vsc.c +9 -5
@@ -400,11 +400,15 @@ static int vsc_sata_init_one(struct pci_dev *pdev, }static const struct pci_device_id vsc_sata_pci_tbl[] = { - {PCI_VENDOR_ID_VITESSE ,0x7174 , -PCI_ANY_ID ,PCI_ANY_ID ,0x10600 ,0xFFFFFF ,0 }, - {PCI_VENDOR_ID_INTEL ,0x3200 , -PCI_ANY_ID ,PCI_ANY_ID ,0x10600 ,0xFFFFFF ,0 }, - + { +PCI_DEVICE (PCI_VENDOR_ID_VITESSE ,0x7174 ), + .class =0x10600 , + .class_mask =0xFFFFFF , + }, { +PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x3200 ), + .class =0x10600 , + .class_mask =0xFFFFFF , + }, { }/* terminate list */ };
Signature · 1 line
2.47.3
PATCH v3 2/2 ata: Use named initializers for pci_device_id arrays
In reply to Uwe Kleine-König (The Capable Hub)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 pci_device_id that replaces .driver_data by an anonymous union.
Also drop the comma after a few list terminators.
This patch doesn't modify the compiled array, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds.
--- drivers/ata/acard-ahci.c | 8 +- drivers/ata/ahci.c | 1626 ++++++++++++++++++++++++------- drivers/ata/ata_piix.c | 532 ++++++---- drivers/ata/pata_acpi.c | 5 +- drivers/ata/pata_amd.c | 88 +- drivers/ata/pata_artop.c | 11 +- drivers/ata/pata_cmd64x.c | 11 +- drivers/ata/pata_opti.c | 7 +- drivers/ata/pata_pdc2027x.c | 30 +- drivers/ata/pata_pdc202xx_old.c | 13 +- drivers/ata/pata_serverworks.c | 24 +- drivers/ata/pata_sis.c | 1 - drivers/ata/pata_via.c | 19 +- drivers/ata/pdc_adma.c | 3 +- drivers/ata/sata_mv.c | 34 +- drivers/ata/sata_nv.c | 58 +- drivers/ata/sata_promise.c | 34 +- drivers/ata/sata_qstor.c | 3 +- drivers/ata/sata_sil.c | 15 +- drivers/ata/sata_sil24.c | 15 +- drivers/ata/sata_sis.c | 32 +- drivers/ata/sata_svw.c | 15 +- drivers/ata/sata_sx4.c | 3 +- drivers/ata/sata_uli.c | 7 +- drivers/ata/sata_via.c | 38 +- 25 files changed, 1932 insertions(+), 700 deletions(-)
drivers/ata/acard-ahci.c +5 -3
@@ -91,9 +91,11 @@ static const struct ata_port_info acard_ahci_port_info[] = { };static const struct pci_device_id acard_ahci_pci_tbl[] = { -/* ACard */ - {PCI_VDEVICE (ARTOP ,0x000d ), board_acard_ahci },/* ATP8620 */ - + { +/* ACard ATP8620 */ +PCI_VDEVICE (ARTOP ,0x000d ), + .driver_data = board_acard_ahci, + }, { }/* terminate list */ };
drivers/ata/ahci.c +1277 -349
1,661 lines not on this page · raw message
drivers/ata/ata_piix.c +356 -176
540 lines not on this page · raw message
drivers/ata/pata_acpi.c +4 -1
@@ -257,7 +257,10 @@ static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) }static const struct pci_device_id pacpi_pci_tbl[] = { - {PCI_ANY_ID ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_STORAGE_IDE <<8 ,0xFFFFFF00UL ,1 }, + { +PCI_DEVICE_CLASS (PCI_CLASS_STORAGE_IDE <<8 ,0xFFFFFF00UL ), + .driver_data =1 ,/* is this used at all? */ + }, { }/* terminate list */ };
drivers/ata/pata_amd.c +65 -23
94 lines not on this page · raw message
drivers/ata/pata_artop.c +5 -6
@@ -421,12 +421,11 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) }static const struct pci_device_id artop_pci_tbl[] = { - {PCI_VDEVICE (ARTOP ,0x0005 ),0 }, - {PCI_VDEVICE (ARTOP ,0x0006 ),1 }, - {PCI_VDEVICE (ARTOP ,0x0007 ),1 }, - {PCI_VDEVICE (ARTOP ,0x0008 ),2 }, - {PCI_VDEVICE (ARTOP ,0x0009 ),2 }, - + {PCI_VDEVICE (ARTOP ,0x0005 ), .driver_data =0 }, + {PCI_VDEVICE (ARTOP ,0x0006 ), .driver_data =1 }, + {PCI_VDEVICE (ARTOP ,0x0007 ), .driver_data =1 }, + {PCI_VDEVICE (ARTOP ,0x0008 ), .driver_data =2 }, + {PCI_VDEVICE (ARTOP ,0x0009 ), .driver_data =2 }, { }/* terminate list */ };
drivers/ata/pata_cmd64x.c +5 -6
@@ -506,12 +506,11 @@ static int cmd64x_reinit_one(struct pci_dev *pdev)#endif static const struct pci_device_id cmd64x[] = { - {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_643 ),0 }, - {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_646 ),1 }, - {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_648 ),5 }, - {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_649 ),6 }, - - { }, + {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_643 ), .driver_data =0 }, + {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_646 ), .driver_data =1 }, + {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_648 ), .driver_data =5 }, + {PCI_VDEVICE (CMD ,PCI_DEVICE_ID_CMD_649 ), .driver_data =6 }, + { } };static struct pci_driver cmd64x_pci_driver = {
drivers/ata/pata_opti.c +3 -4
@@ -174,10 +174,9 @@ static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) }static const struct pci_device_id opti[] = { - {PCI_VDEVICE (OPTI ,PCI_DEVICE_ID_OPTI_82C621 ),0 }, - {PCI_VDEVICE (OPTI ,PCI_DEVICE_ID_OPTI_82C825 ),1 }, - - { }, + {PCI_VDEVICE (OPTI ,PCI_DEVICE_ID_OPTI_82C621 ), .driver_data =0 }, + {PCI_VDEVICE (OPTI ,PCI_DEVICE_ID_OPTI_82C825 ), .driver_data =1 }, + { } };static struct pci_driver opti_pci_driver = {
drivers/ata/pata_pdc2027x.c +22 -8
@@ -100,14 +100,28 @@ static const struct pdc2027x_udma_timing { };static const struct pci_device_id pdc2027x_pci_tbl[] = { - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20268 ),PDC_UDMA_100 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20269 ),PDC_UDMA_133 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20270 ),PDC_UDMA_100 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20271 ),PDC_UDMA_133 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20275 ),PDC_UDMA_133 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20276 ),PDC_UDMA_133 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20277 ),PDC_UDMA_133 }, - + { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20268 ), + .driver_data =PDC_UDMA_100 , + }, { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20269 ), + .driver_data =PDC_UDMA_133 , + }, { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20270 ), + .driver_data =PDC_UDMA_100 , + }, { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20271 ), + .driver_data =PDC_UDMA_133 , + }, { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20275 ), + .driver_data =PDC_UDMA_133 , + }, { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20276 ), + .driver_data =PDC_UDMA_133 , + }, { +PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20277 ), + .driver_data =PDC_UDMA_133 , + }, { }/* terminate list */ };
drivers/ata/pata_pdc202xx_old.c +6 -7
@@ -362,13 +362,12 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id }static const struct pci_device_id pdc202xx[] = { - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20246 ),0 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20262 ),1 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20263 ),1 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20265 ),2 }, - {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20267 ),2 }, - - { }, + {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20246 ), .driver_data =0 }, + {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20262 ), .driver_data =1 }, + {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20263 ), .driver_data =1 }, + {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20265 ), .driver_data =2 }, + {PCI_VDEVICE (PROMISE ,PCI_DEVICE_ID_PROMISE_20267 ), .driver_data =2 }, + { } };static struct pci_driver pdc202xx_pci_driver = {
drivers/ata/pata_serverworks.c +17 -7
@@ -467,13 +467,23 @@ static int serverworks_reinit_one(struct pci_dev *pdev)#endif static const struct pci_device_id serverworks[] = { - {PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_OSB4IDE ),0 }, - {PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE ),2 }, - {PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ),2 }, - {PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 ),2 }, - {PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_HT1000IDE ),2 }, - - { }, + { +PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_OSB4IDE ), + .driver_data =0 , + }, { +PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB5IDE ), + .driver_data =2 , + }, { +PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ), + .driver_data =2 , + }, { +PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 ), + .driver_data =2 , + }, { +PCI_VDEVICE (SERVERWORKS ,PCI_DEVICE_ID_SERVERWORKS_HT1000IDE ), + .driver_data =2 + }, + { } };static struct pci_driver serverworks_pci_driver = {
drivers/ata/pata_sis.c +0 -1
@@ -891,7 +891,6 @@ static const struct pci_device_id sis_pci_tbl[] = { { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */ { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */ { PCI_VDEVICE(SI, 0x1180), }, /* SiS 1180 */ - { } };
drivers/ata/pata_via.c +9 -10
@@ -675,16 +675,15 @@ static int via_reinit_one(struct pci_dev *pdev)#endif static const struct pci_device_id via[] = { - {PCI_VDEVICE (VIA ,0x0415 ), }, - {PCI_VDEVICE (VIA ,0x0571 ), }, - {PCI_VDEVICE (VIA ,0x0581 ), }, - {PCI_VDEVICE (VIA ,0x1571 ), }, - {PCI_VDEVICE (VIA ,0x3164 ), }, - {PCI_VDEVICE (VIA ,0x5324 ), }, - {PCI_VDEVICE (VIA ,0xC409 ),VIA_IDFLAG_SINGLE }, - {PCI_VDEVICE (VIA ,0x9001 ),VIA_IDFLAG_SINGLE }, - - { }, + {PCI_VDEVICE (VIA ,0x0415 ), .driver_data =0 }, + {PCI_VDEVICE (VIA ,0x0571 ), .driver_data =0 }, + {PCI_VDEVICE (VIA ,0x0581 ), .driver_data =0 }, + {PCI_VDEVICE (VIA ,0x1571 ), .driver_data =0 }, + {PCI_VDEVICE (VIA ,0x3164 ), .driver_data =0 }, + {PCI_VDEVICE (VIA ,0x5324 ), .driver_data =0 }, + {PCI_VDEVICE (VIA ,0xC409 ), .driver_data =VIA_IDFLAG_SINGLE }, + {PCI_VDEVICE (VIA ,0x9001 ), .driver_data =VIA_IDFLAG_SINGLE }, + { } };static struct pci_driver via_pci_driver = {
drivers/ata/pdc_adma.c +1 -2
@@ -157,8 +157,7 @@ static struct ata_port_info adma_port_info[] = { };static const struct pci_device_id adma_ata_pci_tbl[] = { - {PCI_VDEVICE (PDC ,0x1841 ), board_1841_idx }, - + {PCI_VDEVICE (PDC ,0x1841 ), .driver_data = board_1841_idx }, { }/* terminate list */ };
drivers/ata/sata_mv.c +17 -17
@@ -4274,32 +4274,32 @@ static int mv_pci_device_resume(struct pci_dev *pdev);#endif static const struct pci_device_id mv_pci_tbl[] = { - {PCI_VDEVICE (MARVELL ,0x5040 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5041 ), chip_504x }, - {PCI_VDEVICE (MARVELL ,0x5080 ), chip_5080 }, - {PCI_VDEVICE (MARVELL ,0x5081 ), chip_508x }, + {PCI_VDEVICE (MARVELL ,0x5040 ), .driver_data = chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5041 ), .driver_data = chip_504x }, + {PCI_VDEVICE (MARVELL ,0x5080 ), .driver_data = chip_5080 }, + {PCI_VDEVICE (MARVELL ,0x5081 ), .driver_data = chip_508x },/* RocketRAID 1720/174x have different identifiers */ - {PCI_VDEVICE (TTI ,0x1720 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1740 ), chip_6042 }, - {PCI_VDEVICE (TTI ,0x1742 ), chip_6042 }, + {PCI_VDEVICE (TTI ,0x1720 ), .driver_data = chip_6042 }, + {PCI_VDEVICE (TTI ,0x1740 ), .driver_data = chip_6042 }, + {PCI_VDEVICE (TTI ,0x1742 ), .driver_data = chip_6042 }, - {PCI_VDEVICE (MARVELL ,0x6040 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6041 ), chip_604x }, - {PCI_VDEVICE (MARVELL ,0x6042 ), chip_6042 }, - {PCI_VDEVICE (MARVELL ,0x6080 ), chip_608x }, - {PCI_VDEVICE (MARVELL ,0x6081 ), chip_608x }, + {PCI_VDEVICE (MARVELL ,0x6040 ), .driver_data = chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6041 ), .driver_data = chip_604x }, + {PCI_VDEVICE (MARVELL ,0x6042 ), .driver_data = chip_6042 }, + {PCI_VDEVICE (MARVELL ,0x6080 ), .driver_data = chip_608x }, + {PCI_VDEVICE (MARVELL ,0x6081 ), .driver_data = chip_608x }, - {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), chip_604x }, + {PCI_VDEVICE (ADAPTEC2 ,0x0241 ), .driver_data = chip_604x },/* Adaptec 1430SA */ - {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), chip_7042 }, + {PCI_VDEVICE (ADAPTEC2 ,0x0243 ), .driver_data = chip_7042 },/* Marvell 7042 support */ - {PCI_VDEVICE (MARVELL ,0x7042 ), chip_7042 }, + {PCI_VDEVICE (MARVELL ,0x7042 ), .driver_data = chip_7042 },/* Highpoint RocketRAID PCIe series */ - {PCI_VDEVICE (TTI ,0x2300 ), chip_7042 }, - {PCI_VDEVICE (TTI ,0x2310 ), chip_7042 }, + {PCI_VDEVICE (TTI ,0x2300 ), .driver_data = chip_7042 }, + {PCI_VDEVICE (TTI ,0x2310 ), .driver_data = chip_7042 }, { }/* terminate list */ };
drivers/ata/sata_nv.c +43 -15
64 lines not on this page · raw message
drivers/ata/sata_promise.c +17 -17
@@ -281,25 +281,25 @@ static const struct ata_port_info pdc_port_info[] = { };static const struct pci_device_id pdc_ata_pci_tbl[] = { - {PCI_VDEVICE (PROMISE ,0x3371 ), board_2037x }, - {PCI_VDEVICE (PROMISE ,0x3373 ), board_2037x }, - {PCI_VDEVICE (PROMISE ,0x3375 ), board_2037x }, - {PCI_VDEVICE (PROMISE ,0x3376 ), board_2037x }, - {PCI_VDEVICE (PROMISE ,0x3570 ), board_2057x }, - {PCI_VDEVICE (PROMISE ,0x3571 ), board_2057x }, - {PCI_VDEVICE (PROMISE ,0x3574 ), board_2057x }, - {PCI_VDEVICE (PROMISE ,0x3577 ), board_2057x }, - {PCI_VDEVICE (PROMISE ,0x3d73 ), board_2057x }, - {PCI_VDEVICE (PROMISE ,0x3d75 ), board_2057x }, + {PCI_VDEVICE (PROMISE ,0x3371 ), .driver_data = board_2037x }, + {PCI_VDEVICE (PROMISE ,0x3373 ), .driver_data = board_2037x }, + {PCI_VDEVICE (PROMISE ,0x3375 ), .driver_data = board_2037x }, + {PCI_VDEVICE (PROMISE ,0x3376 ), .driver_data = board_2037x }, + {PCI_VDEVICE (PROMISE ,0x3570 ), .driver_data = board_2057x }, + {PCI_VDEVICE (PROMISE ,0x3571 ), .driver_data = board_2057x }, + {PCI_VDEVICE (PROMISE ,0x3574 ), .driver_data = board_2057x }, + {PCI_VDEVICE (PROMISE ,0x3577 ), .driver_data = board_2057x }, + {PCI_VDEVICE (PROMISE ,0x3d73 ), .driver_data = board_2057x }, + {PCI_VDEVICE (PROMISE ,0x3d75 ), .driver_data = board_2057x }, - {PCI_VDEVICE (PROMISE ,0x3318 ), board_20319 }, - {PCI_VDEVICE (PROMISE ,0x3319 ), board_20319 }, - {PCI_VDEVICE (PROMISE ,0x3515 ), board_40518 }, - {PCI_VDEVICE (PROMISE ,0x3519 ), board_40518 }, - {PCI_VDEVICE (PROMISE ,0x3d17 ), board_40518 }, - {PCI_VDEVICE (PROMISE ,0x3d18 ), board_40518 }, + {PCI_VDEVICE (PROMISE ,0x3318 ), .driver_data = board_20319 }, + {PCI_VDEVICE (PROMISE ,0x3319 ), .driver_data = board_20319 }, + {PCI_VDEVICE (PROMISE ,0x3515 ), .driver_data = board_40518 }, + {PCI_VDEVICE (PROMISE ,0x3519 ), .driver_data = board_40518 }, + {PCI_VDEVICE (PROMISE ,0x3d17 ), .driver_data = board_40518 }, + {PCI_VDEVICE (PROMISE ,0x3d18 ), .driver_data = board_40518 }, - {PCI_VDEVICE (PROMISE ,0x6629 ), board_20619 }, + {PCI_VDEVICE (PROMISE ,0x6629 ), .driver_data = board_20619 }, { }/* terminate list */ };
drivers/ata/sata_qstor.c +1 -2
@@ -146,8 +146,7 @@ static const struct ata_port_info qs_port_info[] = { };static const struct pci_device_id qs_ata_pci_tbl[] = { - {PCI_VDEVICE (PDC ,0x2068 ), board_2068_idx }, - + {PCI_VDEVICE (PDC ,0x2068 ), .driver_data = board_2068_idx }, { }/* terminate list */ };
drivers/ata/sata_sil.c +7 -8
@@ -112,14 +112,13 @@ static void sil_thaw(struct ata_port *ap);static const struct pci_device_id sil_pci_tbl[] = { - {PCI_VDEVICE (CMD ,0x3112 ), sil_3112 }, - {PCI_VDEVICE (CMD ,0x0240 ), sil_3112 }, - {PCI_VDEVICE (CMD ,0x3512 ), sil_3512 }, - {PCI_VDEVICE (CMD ,0x3114 ), sil_3114 }, - {PCI_VDEVICE (ATI ,0x436e ), sil_3112 }, - {PCI_VDEVICE (ATI ,0x4379 ), sil_3112_no_sata_irq }, - {PCI_VDEVICE (ATI ,0x437a ), sil_3112_no_sata_irq }, - + {PCI_VDEVICE (CMD ,0x3112 ), .driver_data = sil_3112 }, + {PCI_VDEVICE (CMD ,0x0240 ), .driver_data = sil_3112 }, + {PCI_VDEVICE (CMD ,0x3512 ), .driver_data = sil_3512 }, + {PCI_VDEVICE (CMD ,0x3114 ), .driver_data = sil_3114 }, + {PCI_VDEVICE (ATI ,0x436e ), .driver_data = sil_3112 }, + {PCI_VDEVICE (ATI ,0x4379 ), .driver_data = sil_3112_no_sata_irq }, + {PCI_VDEVICE (ATI ,0x437a ), .driver_data = sil_3112_no_sata_irq }, { }/* terminate list */ };
drivers/ata/sata_sil24.c +7 -8
@@ -351,14 +351,13 @@ static int sil24_port_resume(struct ata_port *ap);#endif static const struct pci_device_id sil24_pci_tbl[] = { - {PCI_VDEVICE (CMD ,0x3124 ),BID_SIL3124 }, - {PCI_VDEVICE (INTEL ,0x3124 ),BID_SIL3124 }, - {PCI_VDEVICE (CMD ,0x3132 ),BID_SIL3132 }, - {PCI_VDEVICE (CMD ,0x0242 ),BID_SIL3132 }, - {PCI_VDEVICE (CMD ,0x0244 ),BID_SIL3132 }, - {PCI_VDEVICE (CMD ,0x3131 ),BID_SIL3131 }, - {PCI_VDEVICE (CMD ,0x3531 ),BID_SIL3131 }, - + {PCI_VDEVICE (CMD ,0x3124 ), .driver_data =BID_SIL3124 }, + {PCI_VDEVICE (INTEL ,0x3124 ), .driver_data =BID_SIL3124 }, + {PCI_VDEVICE (CMD ,0x3132 ), .driver_data =BID_SIL3132 }, + {PCI_VDEVICE (CMD ,0x0242 ), .driver_data =BID_SIL3132 }, + {PCI_VDEVICE (CMD ,0x0244 ), .driver_data =BID_SIL3132 }, + {PCI_VDEVICE (CMD ,0x3131 ), .driver_data =BID_SIL3131 }, + {PCI_VDEVICE (CMD ,0x3531 ), .driver_data =BID_SIL3131 }, { }/* terminate list */ };
drivers/ata/sata_sis.c +25 -7
@@ -51,13 +51,31 @@ static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);static int sis_scr_write (struct ata_link *link,unsigned int sc_reg,u32 val);static const struct pci_device_id sis_pci_tbl[] = { - {PCI_VDEVICE (SI ,0x0180 ), sis_180 },/* SiS 964/180 */ - {PCI_VDEVICE (SI ,0x0181 ), sis_180 },/* SiS 964/180 */ - {PCI_VDEVICE (SI ,0x0182 ), sis_180 },/* SiS 965/965L */ - {PCI_VDEVICE (SI ,0x0183 ), sis_180 },/* SiS 965/965L */ - {PCI_VDEVICE (SI ,0x1182 ), sis_180 },/* SiS 966/680 */ - {PCI_VDEVICE (SI ,0x1183 ), sis_180 },/* SiS 966/966L/968/680 */ - + { +/* SiS 964/180 */ +PCI_VDEVICE (SI ,0x0180 ), + .driver_data = sis_180, + }, { +/* SiS 964/180 */ +PCI_VDEVICE (SI ,0x0181 ), + .driver_data = sis_180, + }, { +/* SiS 965/965L */ +PCI_VDEVICE (SI ,0x0182 ), + .driver_data = sis_180, + }, { +/* SiS 965/965L */ +PCI_VDEVICE (SI ,0x0183 ), + .driver_data = sis_180, + }, { +/* SiS 966/680 */ +PCI_VDEVICE (SI ,0x1182 ), + .driver_data = sis_180, + }, { +/* SiS 966/966L/968/680 */ +PCI_VDEVICE (SI ,0x1183 ), + .driver_data = sis_180, + }, { }/* terminate list */ };
drivers/ata/sata_svw.c +7 -8
@@ -500,14 +500,13 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en* controller * */ static const struct pci_device_id k2_sata_pci_tbl[] = { - {PCI_VDEVICE (SERVERWORKS ,0x0240 ), chip_svw4 }, - {PCI_VDEVICE (SERVERWORKS ,0x0241 ), chip_svw8 }, - {PCI_VDEVICE (SERVERWORKS ,0x0242 ), chip_svw4 }, - {PCI_VDEVICE (SERVERWORKS ,0x024a ), chip_svw4 }, - {PCI_VDEVICE (SERVERWORKS ,0x024b ), chip_svw4 }, - {PCI_VDEVICE (SERVERWORKS ,0x0410 ), chip_svw42 }, - {PCI_VDEVICE (SERVERWORKS ,0x0411 ), chip_svw43 }, - + {PCI_VDEVICE (SERVERWORKS ,0x0240 ), .driver_data = chip_svw4 }, + {PCI_VDEVICE (SERVERWORKS ,0x0241 ), .driver_data = chip_svw8 }, + {PCI_VDEVICE (SERVERWORKS ,0x0242 ), .driver_data = chip_svw4 }, + {PCI_VDEVICE (SERVERWORKS ,0x024a ), .driver_data = chip_svw4 }, + {PCI_VDEVICE (SERVERWORKS ,0x024b ), .driver_data = chip_svw4 }, + {PCI_VDEVICE (SERVERWORKS ,0x0410 ), .driver_data = chip_svw42 }, + {PCI_VDEVICE (SERVERWORKS ,0x0411 ), .driver_data = chip_svw43 }, { } };
drivers/ata/sata_sx4.c +1 -2
@@ -267,8 +267,7 @@ static const struct ata_port_info pdc_port_info[] = { };static const struct pci_device_id pdc_sata_pci_tbl[] = { - {PCI_VDEVICE (PROMISE ,0x6622 ), board_20621 }, - + {PCI_VDEVICE (PROMISE ,0x6622 ), .driver_data = board_20621 }, { }/* terminate list */ };
drivers/ata/sata_uli.c +3 -4
@@ -45,10 +45,9 @@ static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);static int uli_scr_write (struct ata_link *link,unsigned int sc_reg,u32 val);static const struct pci_device_id uli_pci_tbl[] = { - {PCI_VDEVICE (AL ,0x5289 ), uli_5289 }, - {PCI_VDEVICE (AL ,0x5287 ), uli_5287 }, - {PCI_VDEVICE (AL ,0x5281 ), uli_5281 }, - + {PCI_VDEVICE (AL ,0x5289 ), .driver_data = uli_5289 }, + {PCI_VDEVICE (AL ,0x5287 ), .driver_data = uli_5287 }, + {PCI_VDEVICE (AL ,0x5281 ), .driver_data = uli_5281 }, { }/* terminate list */ };
drivers/ata/sata_via.c +29 -9
@@ -85,15 +85,35 @@ static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev);static void vt6421_error_handler (struct ata_port *ap);static const struct pci_device_id svia_pci_tbl[] = { - {PCI_VDEVICE (VIA ,0x5337 ), vt6420 }, - {PCI_VDEVICE (VIA ,0x0591 ), vt6420 },/* 2 sata chnls (Master) */ - {PCI_VDEVICE (VIA ,0x3149 ), vt6420 },/* 2 sata chnls (Master) */ - {PCI_VDEVICE (VIA ,0x3249 ), vt6421 },/* 2 sata chnls, 1 pata chnl */ - {PCI_VDEVICE (VIA ,0x5372 ), vt6420 }, - {PCI_VDEVICE (VIA ,0x7372 ), vt6420 }, - {PCI_VDEVICE (VIA ,0x5287 ), vt8251 },/* 2 sata chnls (Master/Slave) */ - {PCI_VDEVICE (VIA ,0x9000 ), vt8251 }, - + { +PCI_VDEVICE (VIA ,0x5337 ), + .driver_data = vt6420, + }, { +/* 2 sata chnls (Master) */ +PCI_VDEVICE (VIA ,0x0591 ), + .driver_data = vt6420, + }, { +/* 2 sata chnls (Master) */ +PCI_VDEVICE (VIA ,0x3149 ), + .driver_data = vt6420, + }, { +/* 2 sata chnls, 1 pata chnl */ +PCI_VDEVICE (VIA ,0x3249 ), + .driver_data = vt6421, + }, { +PCI_VDEVICE (VIA ,0x5372 ), + .driver_data = vt6420, + }, { +PCI_VDEVICE (VIA ,0x7372 ), + .driver_data = vt6420, + }, { +/* 2 sata chnls (Master/Slave) */ +PCI_VDEVICE (VIA ,0x5287 ), + .driver_data = vt8251, + }, { +PCI_VDEVICE (VIA ,0x9000 ), + .driver_data = vt8251, + }, { }/* terminate list */ };
Signature · 1 line
2.47.3
Re: [PATCH v3 2/2] ata: Use named initializers for pci_device_id arrays
Quoted 8 lines · Uwe Kleine-König (The Capable Hub)
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
pci_device_idthat replaces .driver_data by an anonymous union.
Quoted 7 lines
Also drop the comma after a few list terminators.
This patch doesn't modify the compiled array, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds.
Signed-off-by Uwe Kleine-König (The Capable Hub) <[email protected]>
Nice !
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH v3 2/2] ata: Use named initializers for pci_device_id arrays
In reply to Uwe Kleine-König (The Capable Hub)Quoted 4 lines · On Fri, 12 Jun 2026 10:21:48 +0200 Uwe Kleine-König (The Capable Hub)…
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.
I think I'd try to keep each entry on one line for readability. Either by just letting the line be long or using a #define for the initialiser.
...
Quoted 8 lines
drivers/ata/acard-ahci.c +0
-0@@ -91,9 +91,11 @@ static const struct ata_port_info acard_ahci_port_info[] = { };static const struct pci_device_id acard_ahci_pci_tbl[] = {
drivers/ata/acard-ahci.c static const struct ata_port_info acard_ahci_port_info[] = { · line 100
Quoted 10 lines
drivers/ata/acard-ahci.c +5
-3-/* ACard */ - { PCI_VDEVICE(ARTOP, 0x000d), board_acard_ahci }, /* ATP8620 */ - + { +/* ACard ATP8620 */ + PCI_VDEVICE(ARTOP, 0x000d), + .driver_data = board_acard_ahci, + }, { }/* terminate list */ };
Why not extend PCI_VDEVICE so you can pass it the .driver data (and other named initializers), something like:
#define PCI_VDEVICE(vend, dev, ...) \ .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 \ __VA_OPT__(, .driver_data = __VA_ARGS__)
The change to all the files is then just to move the ) (and the old versions will still compile). You can also do:
PCI_VDEVICE(XXX, 0xx, board_xxx, .override_only = 1)
At which point you can move the {} inside - but that is a breaking change.
Note that sparse won't grok __VA_OPT__() so will need an alternate definition.
-- David
Niklas Cassel
maintainerRe: [PATCH v3 2/2] ata: Use named initializers for pci_device_id arrays
Hello David,
Quoted 40 lines · David Laight
Quoted 4 lines · On Fri, 12 Jun 2026 10:21:48 +0200 Uwe Kleine-König (The Capable Hub)…
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.
I think I'd try to keep each entry on one line for readability. Either by just letting the line be long or using a #define for the initialiser.
...
Quoted 8 lines
drivers/ata/acard-ahci.c +0
-0@@ -91,9 +91,11 @@ static const struct ata_port_info acard_ahci_port_info[] = { };static const struct pci_device_id acard_ahci_pci_tbl[] = {drivers/ata/acard-ahci.c static const struct ata_port_info acard_ahci_port_info[] = { · line 100
Quoted 10 lines
drivers/ata/acard-ahci.c +5
-3-/* ACard */ - { PCI_VDEVICE(ARTOP, 0x000d), board_acard_ahci }, /* ATP8620 */ - + { +/* ACard ATP8620 */ + PCI_VDEVICE(ARTOP, 0x000d), + .driver_data = board_acard_ahci, + }, { }/* terminate list */ };Why not extend
PCI_VDEVICEso you can pass it the .driver data (and other named initializers), something like:#define PCI_VDEVICE(vend, dev, ...) \ .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 \ __VA_OPT__(, .driver_data = __VA_ARGS__)
Quoted 8 lines
The change to all the files is then just to move the ) (and the old versions will still compile). You can also do:
PCI_VDEVICE(XXX, 0xx, board_xxx, .override_only = 1)At which point you can move the {} inside - but that is a breaking change.
Note that sparse won't grok
__VA_OPT__()so will need an alternate definition.
Sounds like a good idea to me, but it also sounds like it would touch include/linux/pci.h, so probably would need to go via the PCI tree.
But if you manage to get your suggested macro included, I would be happy to take patches that makes use of it. (Or even carry to carry a patch that adds the macro if you manage to get an Acked-by from the PCI maintainers.)
Kind regards,
Niklas
Quoted 9 lines · Uwe Kleine-König (The Capable Hub)
changes since v2 from earlier today
(https://lore.kernel.org/linux-ide/[email protected])
is only rewrapping thepci_device_idindrivers/ata/pata_pdc2027x.c,drivers/ata/pata_serverworks.c,drivers/ata/sata_nv.c,drivers/ata/sata_sis.canddrivers/ata/sata_via.cto keep below 81 chars per line. This only affects patch #2. So I added Damien's Reviewed-by:
tag for the unchanged patch #1.[...]
Applied to libata/linux.git (for-7.2), thanks!
[1/2] ata: Drop unused assignments of pci_device_id driver data
https://git.kernel.org/libata/linux/c/3b5b35f2 [2/2] ata: Use named initializers for pci_device_id arrays https://git.kernel.org/libata/linux/c/21e7b971
Kind regards,
Niklas