]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mtd: Consistently define pci_device_ids
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Fri, 22 May 2026 17:32:34 +0000 (19:32 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 27 May 2026 09:11:04 +0000 (11:11 +0200)
Initializing a pci_device_id using plain list expressions is hard to
understand for a human who isn't into the Linux PCI subsystem. So for
each initializer use one of the PCI_DEVICE macros for .vendor, .device,
.subvendor and .subdevice and named initializers for the remaining
assignments. This makes it easier to parse and also more robust against
chagnes to the struct definition.

Also drop useless zeros and commas.

The mentioned robustness is relevant for a planned change to struct
pci_device_id that replaces .driver_data by an anonymous union.

This change doesn't introduce changes to the compiled pci_device_id
array. Tested on x86 and arm64.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/maps/amd76xrom.c
drivers/mtd/maps/ck804xrom.c
drivers/mtd/maps/esb2rom.c
drivers/mtd/maps/ichxrom.c
drivers/mtd/maps/pci.c
drivers/mtd/maps/scb2_flash.c
drivers/mtd/nand/raw/cafe_nand.c
drivers/mtd/nand/raw/denali_pci.c
drivers/mtd/nand/raw/r852.c

index 95f9b99ce5fc24190716ca1e6e1819d22b71c509..457e6ab7f3fb16cb090bae5304ef7e926575e98c 100644 (file)
@@ -296,12 +296,10 @@ static void amd76xrom_remove_one(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id amd76xrom_pci_tbl[] = {
-       { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410,
-               PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7440,
-               PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_AMD, 0x7468 }, /* amd8111 support */
-       { 0, }
+       { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410) },
+       { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7440) },
+       { PCI_DEVICE_SUB(PCI_VENDOR_ID_AMD, 0x7468, 0, 0) }, /* amd8111 support */
+       { }
 };
 
 MODULE_DEVICE_TABLE(pci, amd76xrom_pci_tbl);
index 5e44134caa8ec67f2ac3f4ebd74f84ffe104647c..ef4afa8c1931f90427c8dec6cd15ce9628ef8aed 100644 (file)
@@ -335,7 +335,7 @@ static const struct pci_device_id ck804xrom_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0365), .driver_data = DEV_MCP55 },
        { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0366), .driver_data = DEV_MCP55 },
        { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0367), .driver_data = DEV_MCP55 },
-       { 0, }
+       { }
 };
 
 #if 0
index fc7f2c3a62b0793eba49198b485b0483354ef380..043bad544414ae28c8bac4abd3be9a526a837b70 100644 (file)
@@ -385,19 +385,13 @@ static void esb2rom_remove_one(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id esb2rom_pci_tbl[] = {
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { 0, },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0) },
+       { },
 };
 
 #if 0
index 6608b782149ba0eaa11064e13674ed84578a8f83..8fecd1820f6e07d57319d95d99a742fad3ba04a0 100644 (file)
@@ -323,17 +323,12 @@ static void ichxrom_remove_one(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id ichxrom_pci_tbl[] = {
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1,
-         PCI_ANY_ID, PCI_ANY_ID, },
-       { 0, },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0), },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0), },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0), },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0), },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1), },
+       { },
 };
 
 #if 0
index 4a84ca8aed40d3fd65726f203077c780e1d35f08..34041cc8f173a4057a6fb49ab164af2cda53ea25 100644 (file)
@@ -227,22 +227,16 @@ static struct mtd_pci_info intel_dc21285_info = {
 
 static const struct pci_device_id mtd_pci_ids[] = {
        {
-               .vendor =       PCI_VENDOR_ID_INTEL,
-               .device =       0x530d,
-               .subvendor =    PCI_ANY_ID,
-               .subdevice =    PCI_ANY_ID,
+               PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x530d),
                .class =        PCI_CLASS_MEMORY_OTHER << 8,
                .class_mask =   0xffff00,
                .driver_data =  (unsigned long)&intel_iq80310_info,
-       },
-       {
-               .vendor =       PCI_VENDOR_ID_DEC,
-               .device =       PCI_DEVICE_ID_DEC_21285,
-               .subvendor =    0,      /* DC21285 defaults to 0 on reset */
-               .subdevice =    0,      /* DC21285 defaults to 0 on reset */
+       }, {
+               /* DC21285 defaults to 0 for .subvendor and .subdevice on reset */
+               PCI_DEVICE_SUB(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, 0, 0),
                .driver_data =  (unsigned long)&intel_dc21285_info,
        },
-       { 0, }
+       { }
 };
 
 /*
index 57303f904bc1200dce8b523d9ecd65162e523828..5c7e1dad101ba17a52186613f75c0e793255fcf8 100644 (file)
@@ -215,13 +215,8 @@ static void scb2_flash_remove(struct pci_dev *dev)
 }
 
 static struct pci_device_id scb2_flash_pci_ids[] = {
-       {
-         .vendor = PCI_VENDOR_ID_SERVERWORKS,
-         .device = PCI_DEVICE_ID_SERVERWORKS_CSB5,
-         .subvendor = PCI_ANY_ID,
-         .subdevice = PCI_ANY_ID
-       },
-       { 0, }
+       { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5) },
+       { }
 };
 
 static struct pci_driver scb2_flash_driver = {
index c4018bc59670db2a44e371e4cb4af1b43a3faaab..f3117b031cd2481462ec630c626ab890e9d9ab37 100644 (file)
@@ -830,8 +830,7 @@ static void cafe_nand_remove(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id cafe_nand_tbl[] = {
-       { PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_88ALP01_NAND,
-         PCI_ANY_ID, PCI_ANY_ID },
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_88ALP01_NAND) },
        { }
 };
 
index 97fa32d73441bb9d00b1502e06987f1146851773..f53df1b32ddab9a326feb3ae3ee4d9be0ceb33c3 100644 (file)
@@ -19,8 +19,8 @@
 
 /* List of platforms this NAND controller has be integrated into */
 static const struct pci_device_id denali_pci_ids[] = {
-       { PCI_VDEVICE(INTEL, 0x0701), INTEL_CE4100 },
-       { PCI_VDEVICE(INTEL, 0x0809), INTEL_MRST },
+       { PCI_VDEVICE(INTEL, 0x0701), .driver_data = INTEL_CE4100 },
+       { PCI_VDEVICE(INTEL, 0x0809), .driver_data = INTEL_MRST },
        { /* end: all zeroes */ }
 };
 MODULE_DEVICE_TABLE(pci, denali_pci_ids);
index 8a5572b30893731c2bba2b1c96d2af8d795c9e9b..92c47d351c27815a54b969483870067ed27d4077 100644 (file)
@@ -1070,8 +1070,8 @@ static int r852_resume(struct device *device)
 
 static const struct pci_device_id r852_pci_id_tbl[] = {
 
-       { PCI_VDEVICE(RICOH, 0x0852), },
-       { },
+       { PCI_VDEVICE(RICOH, 0x0852) },
+       { }
 };
 
 MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl);