Skip to contentSkip to conversation

scsi: Consistently define pci_device_ids using named initializers

PATCH RESEND Applied Uwe Kleine-König (The Capable Hub) 3 participants 3 messages Nov 11 – Nov 21

Subsystems (19)

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 scsi: Consistently define pci_device_ids using named initializers

... and PCI device helpers.

The various struct pci_device_id arrays were initialized mostly by one of the PCI_DEVICE macros and then list expressions. The latter isn't easily readable if you're not into PCI. Using named initializers is more explicit and thus easier to parse.

Also use PCI_DEVICE* helper macros to assign .vendor, .device, .subvendor and .subdevice where appropriate and skip explicit assignments of 0 (which the compiler takes care of).

The secret plan is to make struct pci_device_id::driver_data an anonymous union (similar to
https://lore.kernel.org/all/[email protected]/)
and that requires named initializers. But it's also a nice cleanup on its own.

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

---
Hello,

this patch was sent initially back in April with not maintainer feedback despite several pings. So I'm trying with a resend now.

Best regards
Uwe

 drivers/scsi/3w-9xxx.c                 |  12 +-
 drivers/scsi/3w-xxxx.c                 |   6 +-
 drivers/scsi/a100u2w.c                 |   6 +-
 drivers/scsi/aacraid/linit.c           | 138 +++++------
 drivers/scsi/advansys.c                |  20 +-
 drivers/scsi/aic7xxx/aiclib.h          |   8 +-
 drivers/scsi/aic94xx/aic94xx_init.c    |  20 +-
 drivers/scsi/am53c974.c                |   3 +-
 drivers/scsi/csiostor/csio_init.c      |   4 +-
 drivers/scsi/dmx3191d.c                |   6 +-
 drivers/scsi/elx/efct/efct_driver.c    |   6 +-
 drivers/scsi/esas2r/esas2r_main.c      |  31 +--
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |   4 +-
 drivers/scsi/hpsa.c                    | 118 +++++-----
 drivers/scsi/hptiop.c                  |  66 +++---
 drivers/scsi/initio.c                  |  12 +-
 drivers/scsi/ipr.c                     | 310 ++++++++++++++++---------
 drivers/scsi/megaraid.c                |  11 +-
 drivers/scsi/mvsas/mv_init.c           |  86 +++----
 drivers/scsi/pm8001/pm8001_init.c      | 243 +++++++++++++------
 drivers/scsi/pmcraid.c                 |   7 +-
 drivers/scsi/qla1280.c                 |  22 +-
 drivers/scsi/stex.c                    |  91 +++++---
 drivers/scsi/sym53c8xx_2/sym_glue.c    |  62 +++--
 24 files changed, 725 insertions(+), 567 deletions(-)
drivers/scsi/3w-9xxx.c +4 -8
index e6694f242ebe..a89869c57da7 100644
@@ -2262,14 +2262,10 @@ static int __maybe_unused twa_resume(struct device *dev)
 
 /* PCI Devices supported by this driver */
 static const struct pci_device_id twa_pci_tbl[] = {
-	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9650SE,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9690SA,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9000) },
+	{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9550SX) },
+	{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9650SE) },
+	{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9690SA) },
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, twa_pci_tbl);
drivers/scsi/3w-xxxx.c +2 -4
index 11326465abb6..0b6335a373c4 100644
@@ -2395,10 +2395,8 @@ static void tw_remove(struct pci_dev *pdev)
 
 /* PCI Devices supported by this driver */
 static const struct pci_device_id tw_pci_tbl[] = {
-	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_1000,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_7000,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_1000) },
+	{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_7000) },
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, tw_pci_tbl);
drivers/scsi/a100u2w.c +3 -3
index 7e6776325d9b..3c8a8100741d 100644
@@ -1204,11 +1204,11 @@ static void inia100_remove_one(struct pci_dev *pdev)
         release_region(shost->io_port, 256);
 
 	scsi_host_put(shost);
-} 
+}
 
 static const struct pci_device_id inia100_pci_tbl[] = {
-	{PCI_VENDOR_ID_INIT, 0x1060, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{0,}
+	{ PCI_VDEVICE(INIT, 0x1060) },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, inia100_pci_tbl);
 
drivers/scsi/aacraid/linit.c +69 -69

149 lines not on this page · raw message

drivers/scsi/advansys.c +7 -13
index e6fa05ffc024..4e5c7a6d9ce3 100644
@@ -11409,19 +11409,13 @@ static struct eisa_driver advansys_eisa_driver = {
 
 /* PCI Devices supported by this driver */
 static const struct pci_device_id advansys_pci_tbl[] = {
-	{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A,
-	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940,
-	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940U,
-	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940UW,
-	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C0800_REV1,
-	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C1600_REV1,
-	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{}
+	{ PCI_VDEVICE(ASP, PCI_DEVICE_ID_ASP_1200A) },
+	{ PCI_VDEVICE(ASP, PCI_DEVICE_ID_ASP_ABP940) },
+	{ PCI_VDEVICE(ASP, PCI_DEVICE_ID_ASP_ABP940U) },
+	{ PCI_VDEVICE(ASP, PCI_DEVICE_ID_ASP_ABP940UW) },
+	{ PCI_VDEVICE(ASP, PCI_DEVICE_ID_38C0800_REV1) },
+	{ PCI_VDEVICE(ASP, PCI_DEVICE_ID_38C1600_REV1) },
+	{ }
 };
 
 MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
drivers/scsi/aic7xxx/aiclib.h +4 -4
index ba08eb3c4e3b..0ffc59b93036 100644
@@ -142,10 +142,10 @@ scsi_4btoul(uint8_t *bytes)
 
 #define GETID(v, s) (unsigned)(((v) >> (s)) & 0xFFFF ?: PCI_ANY_ID)
 
-#define ID_C(x, c)						\
-{								\
-	GETID(x,32), GETID(x,48), GETID(x,0), GETID(x,16),	\
-	(c) << 8, 0xFFFF00, 0					\
+#define ID_C(x, c)								\
+{										\
+	PCI_DEVICE_SUB(GETID(x, 32), GETID(x, 48), GETID(x, 0), GETID(x, 16)),	\
+	.class = (c) << 8, .class_mask = 0xFFFF00,				\
 }
 
 #define ID2C(x)                          \
drivers/scsi/aic94xx/aic94xx_init.c +10 -10
index 4400a3661d90..73f9432598c1 100644
@@ -967,16 +967,16 @@ static struct sas_domain_function_template aic94xx_transport_functions = {
 };
 
 static const struct pci_device_id aic94xx_pci_table[] = {
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x410),0, 0, 1},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x412),0, 0, 1},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x416),0, 0, 1},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x41E),0, 0, 1},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x41F),0, 0, 1},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x430),0, 0, 2},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x432),0, 0, 2},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x43E),0, 0, 2},
-	{PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x43F),0, 0, 2},
-	{}
+	{ PCI_VDEVICE(ADAPTEC2, 0x0410), .driver_data = 1 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x0412), .driver_data = 1 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x0416), .driver_data = 1 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x041E), .driver_data = 1 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x041F), .driver_data = 1 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x0430), .driver_data = 2 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x0432), .driver_data = 2 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x043E), .driver_data = 2 },
+	{ PCI_VDEVICE(ADAPTEC2, 0x043F), .driver_data = 2 },
+	{ }
 };
 
 MODULE_DEVICE_TABLE(pci, aic94xx_pci_table);
drivers/scsi/am53c974.c +1 -2
index f972a3c90a2f..ea49379ca9cb 100644
@@ -514,8 +514,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id am53c974_pci_tbl[] = {
-	{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SCSI,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_SCSI) },
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, am53c974_pci_tbl);
drivers/scsi/csiostor/csio_init.c +2 -2
index 238431524801..2df8848ae723 100644
@@ -1176,9 +1176,9 @@ static const struct pci_error_handlers csio_err_handler = {
 #define CH_PCI_DEVICE_ID_FUNCTION	0x6
 
 #define CH_PCI_ID_TABLE_ENTRY(devid) \
-		{ PCI_VDEVICE(CHELSIO, (devid)), 0 }
+		{ PCI_VDEVICE(CHELSIO, (devid)) }
 
-#define CH_PCI_DEVICE_ID_TABLE_DEFINE_END { 0, } }
+#define CH_PCI_DEVICE_ID_TABLE_DEFINE_END { } }
 
 #include "t4_pci_id_tbl.h"
 
drivers/scsi/dmx3191d.c +4 -2
index d6d091b2f3c7..3676400f992a 100644
@@ -128,8 +128,10 @@ static void dmx3191d_remove_one(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id dmx3191d_pci_tbl[] = {
-	{PCI_VENDOR_ID_DOMEX, PCI_DEVICE_ID_DOMEX_DMX3191D,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+	{
+		PCI_VDEVICE(DOMEX, PCI_DEVICE_ID_DOMEX_DMX3191D),
+		.driver_data = 4,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, dmx3191d_pci_tbl);
drivers/scsi/elx/efct/efct_driver.c +3 -3
index 07c2f453459e..35b6dead3736 100644
@@ -465,9 +465,9 @@ efct_setup_msix(struct efct *efct, u32 num_intrs)
 }
 
 static const struct pci_device_id efct_pci_table[] = {
-	{PCI_DEVICE(EFCT_VENDOR_ID, EFCT_DEVICE_LANCER_G6), 0},
-	{PCI_DEVICE(EFCT_VENDOR_ID, EFCT_DEVICE_LANCER_G7), 0},
-	{}	/* terminate list */
+	{ PCI_DEVICE(EFCT_VENDOR_ID, EFCT_DEVICE_LANCER_G6) },
+	{ PCI_DEVICE(EFCT_VENDOR_ID, EFCT_DEVICE_LANCER_G7) },
+	{ }	/* terminate list */
 };
 
 static int
drivers/scsi/esas2r/esas2r_main.c +8 -23
index ada278c24c51..d59b066e9b25 100644
@@ -303,29 +303,14 @@ MODULE_PARM_DESC(interrupt_mode,
 		 "Defines the interrupt mode to use.  0 for legacy"
 		 ", 1 for MSI.  Default is MSI (1).");
 
-static const struct pci_device_id
-	esas2r_pci_table[] = {
-	{ ATTO_VENDOR_ID, 0x0049,	  ATTO_VENDOR_ID, 0x0049,
-	  0,
-	  0, 0 },
-	{ ATTO_VENDOR_ID, 0x0049,	  ATTO_VENDOR_ID, 0x004A,
-	  0,
-	  0, 0 },
-	{ ATTO_VENDOR_ID, 0x0049,	  ATTO_VENDOR_ID, 0x004B,
-	  0,
-	  0, 0 },
-	{ ATTO_VENDOR_ID, 0x0049,	  ATTO_VENDOR_ID, 0x004C,
-	  0,
-	  0, 0 },
-	{ ATTO_VENDOR_ID, 0x0049,	  ATTO_VENDOR_ID, 0x004D,
-	  0,
-	  0, 0 },
-	{ ATTO_VENDOR_ID, 0x0049,	  ATTO_VENDOR_ID, 0x004E,
-	  0,
-	  0, 0 },
-	{ 0,		  0,		  0,		  0,
-	  0,
-	  0, 0 }
+static const struct pci_device_id esas2r_pci_table[] = {
+	{ PCI_DEVICE_SUB(ATTO_VENDOR_ID, 0x0049, ATTO_VENDOR_ID, 0x0049) },
+	{ PCI_DEVICE_SUB(ATTO_VENDOR_ID, 0x0049, ATTO_VENDOR_ID, 0x004A) },
+	{ PCI_DEVICE_SUB(ATTO_VENDOR_ID, 0x0049, ATTO_VENDOR_ID, 0x004B) },
+	{ PCI_DEVICE_SUB(ATTO_VENDOR_ID, 0x0049, ATTO_VENDOR_ID, 0x004C) },
+	{ PCI_DEVICE_SUB(ATTO_VENDOR_ID, 0x0049, ATTO_VENDOR_ID, 0x004D) },
+	{ PCI_DEVICE_SUB(ATTO_VENDOR_ID, 0x0049, ATTO_VENDOR_ID, 0x004E) },
+	{ }
 };
 
 MODULE_DEVICE_TABLE(pci, esas2r_pci_table);
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +2 -2
index 9391d031f5df..bb6a4e33e9b6 100644
@@ -5317,8 +5317,8 @@ static int __maybe_unused resume_v3_hw(struct device *device)
 }
 
 static const struct pci_device_id sas_v3_pci_table[] = {
-	{ PCI_VDEVICE(HUAWEI, 0xa230), hip08 },
-	{}
+	{ PCI_VDEVICE(HUAWEI, 0xa230), .driver_data = hip08 },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, sas_v3_pci_table);
 
drivers/scsi/hpsa.c +60 -58

124 lines not on this page · raw message

drivers/scsi/hptiop.c +33 -33

72 lines not on this page · raw message

drivers/scsi/initio.c +6 -6
index da2670cd7edf..34facaa6d70d 100644
@@ -2942,12 +2942,12 @@ static void initio_remove_one(struct pci_dev *pdev)
 MODULE_LICENSE("GPL");
 
 static const struct pci_device_id initio_pci_tbl[] = {
-	{PCI_VENDOR_ID_INIT, 0x9500, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_INIT, 0x9400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_INIT, 0x9401, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_INIT, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_DOMEX, 0x0002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{0,}
+	{ PCI_VDEVICE(INIT, 0x9500) },
+	{ PCI_VDEVICE(INIT, 0x9400) },
+	{ PCI_VDEVICE(INIT, 0x9401) },
+	{ PCI_VDEVICE(INIT, 0x0002) },
+	{ PCI_VDEVICE(DOMEX, 0x0002) },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, initio_pci_tbl);
 
drivers/scsi/ipr.c +201 -109

316 lines not on this page · raw message

drivers/scsi/megaraid.c +4 -7
index a4079866f747..22e030001ba8 100644
@@ -4554,13 +4554,10 @@ megaraid_shutdown(struct pci_dev *pdev)
 }
 
 static const struct pci_device_id megaraid_pci_tbl[] = {
-	{PCI_VENDOR_ID_AMI, PCI_DEVICE_ID_AMI_MEGARAID,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_AMI, PCI_DEVICE_ID_AMI_MEGARAID2,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_AMI_MEGARAID3,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{0,}
+	{ PCI_VDEVICE(AMI, PCI_DEVICE_ID_AMI_MEGARAID) },
+	{ PCI_VDEVICE(AMI, PCI_DEVICE_ID_AMI_MEGARAID2) },
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_AMI_MEGARAID3) },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, megaraid_pci_tbl);
 
drivers/scsi/mvsas/mv_init.c +31 -55

92 lines not on this page · raw message

drivers/scsi/pm8001/pm8001_init.c +170 -73

249 lines not on this page · raw message

drivers/scsi/pmcraid.c +4 -3
index b68f6460207c..34f10dfc2bd0 100644
@@ -114,10 +114,11 @@ static struct pmcraid_chip_details pmcraid_chip_cfg[] = {
  * PCI device ids supported by pmcraid driver
  */
 static const struct pci_device_id pmcraid_pci_table[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_PMC, PCI_DEVICE_ID_PMC_MAXRAID),
-	  0, 0, (kernel_ulong_t)&pmcraid_chip_cfg[0]
+	{
+		PCI_VDEVICE(PMC, PCI_DEVICE_ID_PMC_MAXRAID),
+		.driver_data = (kernel_ulong_t)&pmcraid_chip_cfg[0],
 	},
-	{}
+	{ }
 };
 
 MODULE_DEVICE_TABLE(pci, pmcraid_pci_table);
drivers/scsi/qla1280.c +8 -14
index f71e668d011c..12e298ed0f05 100644
@@ -502,21 +502,15 @@ struct qla_boards {
 	int fw_index;		/* index into qla1280_fw_tbl for firmware */
 };
 
-/* NOTE: the last argument in each entry is used to index ql1280_board_tbl */
+/* NOTE: the driver_data argument in each entry is used to index ql1280_board_tbl */
 static const struct pci_device_id qla1280_pci_tbl[] = {
-	{PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP12160,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1020,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
-	{PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1080,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
-	{PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1240,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
-	{PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1280,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
-	{PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP10160,
-		PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
-	{0,}
+	{ PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP12160), .driver_data = 0 },
+	{ PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1020), .driver_data = 1 },
+	{ PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1080), .driver_data = 2 },
+	{ PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1240), .driver_data = 3 },
+	{ PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1280), .driver_data = 4 },
+	{ PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP10160), .driver_data = 5 },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, qla1280_pci_tbl);
 
drivers/scsi/stex.c +62 -29

109 lines not on this page · raw message

drivers/scsi/sym53c8xx_2/sym_glue.c +27 -35

68 lines not on this page · raw message

base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5

Signature · 1 line
2.56.0.rc1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] scsi: stex: shifted model comments in stex_pci_tbl mislabel st_P3 PCI IDs --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] scsi: stex: shifted model comments in stex_pci_tbl mislabel st_P3 PCI IDs
--

commit db5880bd5d82ae26b6fc5fffb19956c877343ba5
Author: Uwe Kleine-König (The Capable Hub) <[email protected]>

scsi: Consistently define pci_device_ids using named initializers

This commit converts struct pci_device_id arrays across SCSI drivers to use PCI_DEVICE*() helper macros and named initializers for fields such as .driver_data, .class, and .class_mask.

Quoted 5 lines
drivers/scsi/stex.c +0 -0
index d4899816f7dc8..057aa4b026740 100644
@@ -1489,47 +1489,80 @@ static const struct scsi_host_template driver_template = {

[ ... ]

Quoted 19 lines
drivers/scsi/stex.c +6 -12
 	/* st_P3, pluto */
-	{ PCI_VENDOR_ID_PROMISE, 0x8870, PCI_VENDOR_ID_PROMISE,
-		0x8870, 0, 0, st_P3 },
-	/* st_P3, p3 */
-	{ PCI_VENDOR_ID_PROMISE, 0x8870, PCI_VENDOR_ID_PROMISE,
-		0x4300, 0, 0, st_P3 },
-
-	/* st_P3, SymplyStor4E */
-	{ PCI_VENDOR_ID_PROMISE, 0x8871, PCI_VENDOR_ID_PROMISE,
-		0x4311, 0, 0, st_P3 },
-	/* st_P3, SymplyStor8E */
-	{ PCI_VENDOR_ID_PROMISE, 0x8871, PCI_VENDOR_ID_PROMISE,
-		0x4312, 0, 0, st_P3 },
+	{
+		/* st_P3, p3 */
+		PCI_VDEVICE_SUB(PROMISE, 0x8870, PCI_VENDOR_ID_PROMISE, 0x8870),
+		.driver_data = st_P3,
+	}, {
+		/* st_P3, SymplyStor4E */

drivers/scsi/stex.c static const struct scsi_host_template driver_template = { · line 1564

Quoted 10 lines
drivers/scsi/stex.c +10 -0
+		PCI_VDEVICE_SUB(PROMISE, 0x8870, PCI_VENDOR_ID_PROMISE, 0x4300),
+		.driver_data = st_P3,
+	}, {
+		/* st_P3, SymplyStor8E */
+		PCI_VDEVICE_SUB(PROMISE, 0x8871, PCI_VENDOR_ID_PROMISE, 0x4311),
+		.driver_data = st_P3,
+	}, {
+		PCI_VDEVICE_SUB(PROMISE, 0x8871, PCI_VENDOR_ID_PROMISE, 0x4312),
+		.driver_data = st_P3,
+	},

[Severity: Low]
This isn't a bug, but placing the opening brace of the 0x8870/0x8870 entry between the pluto and p3 comments shifts the model comments for these four st_P3 entries by one element, mislabeling 0x8870/0x8870, 0x8870/0x4300, and 0x8871/0x4311 and leaving 0x8871/0x4312 uncommented.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Applied
#2 lore raw
In reply to Uwe Kleine-König (The Capable Hub)

Uwe,

Quoted 6 lines

... and PCI device helpers.

The various struct pci_device_id arrays were initialized mostly by one of the PCI_DEVICE macros and then list expressions. The latter isn't easily readable if you're not into PCI. Using named initializers is more explicit and thus easier to parse.

Applied to 7.5/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen