Re: [PATCH net-next] net: Consistently define pci_device_ids using named initializers

Marc Kleine-Budde
2026-04-29T09:11:26Z

[-- Attachment #1: Type: text/plain, Size: 8338 bytes --]

On 28.04.2026 19:18:44, Uwe Kleine-König (The Capable Hub) wrote:
> drivers/net/can/m_can/m_can_pci.c | 6 +-
> drivers/net/can/sja1000/plx_pci.c | 167 +++----
[...]
> diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
> index 08183833c9bc..a03553b80a5d 100644
> --- a/drivers/net/can/sja1000/plx_pci.c
> +++ b/drivers/net/can/sja1000/plx_pci.c
> @@ -272,124 +272,89 @@ static struct plx_pci_card_info plx_pci_card_info_asem_dual_can = {
> static const struct pci_device_id plx_pci_tbl[] = {
> {
> /* Adlink PCI-7841/cPCI-7841 */
> - ADLINK_PCI_VENDOR_ID, ADLINK_PCI_DEVICE_ID,
> - PCI_ANY_ID, PCI_ANY_ID,
> - PCI_CLASS_NETWORK_OTHER << 8, ~0,
> - (kernel_ulong_t)&plx_pci_card_info_adlink
> - },
> - {
> + PCI_DEVICE(ADLINK_PCI_VENDOR_ID, ADLINK_PCI_DEVICE_ID),
> + .class = PCI_CLASS_NETWORK_OTHER << 8,
> + .class_mask = ~0,
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_adlink,
> + }, {
> /* Adlink PCI-7841/cPCI-7841 SE */
> - ADLINK_PCI_VENDOR_ID, ADLINK_PCI_DEVICE_ID,
> - PCI_ANY_ID, PCI_ANY_ID,
> - PCI_CLASS_COMMUNICATION_OTHER << 8, ~0,
> - (kernel_ulong_t)&plx_pci_card_info_adlink_se
> - },
> - {
> + PCI_DEVICE(ADLINK_PCI_VENDOR_ID, ADLINK_PCI_DEVICE_ID),
> + .class = PCI_CLASS_COMMUNICATION_OTHER << 8,
> + .class_mask = ~0,
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_adlink_se,
> + }, {
> /* esd CAN-PCI/200 */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
> - PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI200,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_esd200
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9050,
> + PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI200),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_esd200,
> + }, {
> /* esd CAN-CPCI/200 */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
> - PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_CPCI200,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_esd200
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9030,
> + PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_CPCI200),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_esd200,
> + }, {
> /* esd CAN-PCI104/200 */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
> - PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI104200,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_esd200
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9030,
> + PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI104200),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_esd200,
> + }, {
> /* esd CAN-PCI/266 */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056,
> - PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI266,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_esd266
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9056,
> + PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCI266),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_esd266,
> + }, {
> /* esd CAN-PMC/266 */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056,
> - PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PMC266,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_esd266
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9056,
> + PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PMC266),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_esd266,
> + }, {
> /* esd CAN-PCIE/2000 */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9056,
> - PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCIE2000,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_esd2000
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9056,
> + PCI_VENDOR_ID_ESDGMBH, ESD_PCI_SUB_SYS_ID_PCIE2000),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_esd2000,
> + }, {
> /* IXXAT PC-I 04/PCI card */
> - IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID,
> - PCI_ANY_ID, IXXAT_PCI_SUB_SYS_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_ixxat
> - },
> - {
> + PCI_DEVICE_SUB(IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID,
> + PCI_ANY_ID, IXXAT_PCI_SUB_SYS_ID),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_ixxat,
> + }, {
> /* Marathon CAN-bus-PCI card */
> - PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID,
> - PCI_ANY_ID, PCI_ANY_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_marathon_pci
> - },
> - {
> + PCI_VDEVICE(PLX, MARATHON_PCI_DEVICE_ID),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_marathon_pci,
> + }, {
> /* Marathon CAN-bus-PCIe card */
> - PCI_VENDOR_ID_PLX, MARATHON_PCIE_DEVICE_ID,
> - PCI_ANY_ID, PCI_ANY_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_marathon_pcie
> - },
> - {
> + PCI_VDEVICE(PLX, MARATHON_PCIE_DEVICE_ID),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_marathon_pcie,
> + }, {
> /* TEWS TECHNOLOGIES TPMC810 card */
> - TEWS_PCI_VENDOR_ID, TEWS_PCI_DEVICE_ID_TMPC810,
> - PCI_ANY_ID, PCI_ANY_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_tews
> - },
> - {
> + PCI_DEVICE(TEWS_PCI_VENDOR_ID, TEWS_PCI_DEVICE_ID_TMPC810),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_tews,
> + }, {
> /* Connect Tech Inc. CANpro/104-Plus Opto (CRG001) card */
> - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9030,
> - PCI_SUBVENDOR_ID_CONNECT_TECH, CTI_PCI_DEVICE_ID_CRG001,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_cti
> - },
> - {
> + PCI_VDEVICE_SUB(PLX, PCI_DEVICE_ID_PLX_9030,
> + PCI_SUBVENDOR_ID_CONNECT_TECH, CTI_PCI_DEVICE_ID_CRG001),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_cti,
> + }, {
> /* Elcus CAN-200-PCI */
> - CAN200PCI_VENDOR_ID, CAN200PCI_DEVICE_ID,
> - CAN200PCI_SUB_VENDOR_ID, CAN200PCI_SUB_DEVICE_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_elcus
> - },
> - {
> + PCI_DEVICE_SUB(CAN200PCI_VENDOR_ID, CAN200PCI_DEVICE_ID,
> + CAN200PCI_SUB_VENDOR_ID, CAN200PCI_SUB_DEVICE_ID),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_elcus,
> + }, {
> /* moxa */
> - MOXA_PCI_VENDOR_ID, MOXA_PCI_DEVICE_ID,
> - PCI_ANY_ID, PCI_ANY_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_moxa
> - },
> - {
> + PCI_DEVICE(MOXA_PCI_VENDOR_ID, MOXA_PCI_DEVICE_ID),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_moxa,
> + }, {
> /* ASEM Dual CAN raw */
> - ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID,
> - ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_asem_dual_can
> - },
> - {
> + PCI_DEVICE_SUB(ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID,
> + ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_asem_dual_can,
> + }, {
> /* ASEM Dual CAN raw -new model */
> - ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID,
> - ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID_BIS,
> - 0, 0,
> - (kernel_ulong_t)&plx_pci_card_info_asem_dual_can
> + PCI_DEVICE_SUB(ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID,
> + ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID_BIS),
> + .driver_data = (kernel_ulong_t)&plx_pci_card_info_asem_dual_can,
> },
> - { 0,}
> + { }

Nitpick: can you convert the terminating entry to follow the same style
as the rest of the driver:

diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index a03553b80a5d..d69ff0ccfd94 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -353,8 +353,8 @@ static const struct pci_device_id plx_pci_tbl[] = {
PCI_DEVICE_SUB(ASEM_RAW_CAN_VENDOR_ID, ASEM_RAW_CAN_DEVICE_ID,
ASEM_RAW_CAN_SUB_VENDOR_ID, ASEM_RAW_CAN_SUB_DEVICE_ID_BIS),
.driver_data = (kernel_ulong_t)&plx_pci_card_info_asem_dual_can,
- },
- { }
+ }, {
+ }
};
MODULE_DEVICE_TABLE(pci, plx_pci_tbl);

> };
> MODULE_DEVICE_TABLE(pci, plx_pci_tbl);
>

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]