[PATCH v2] net: ena: Make ena_pci_id_tbl.h self-contained and simplify

From
Uwe Kleine-König <hidden>
Date
2026-11-03 13:22:59
Also in
linux-doc, lkml
The header makes use of struct pci_device_id and PCI_VENDOR_ID_AMAZON.
Include the needed header for those and drop the local definition of the
latter.

While touching this file drop some cpp guards and improve the coding
style.

Signed-off-by: Uwe Kleine-König <redacted>
---
Hello,

(implicit) v1 of this patch had a different subject, so maybe teh
automatisms won't find it for automatic comparison, but you can find it
at
https://lore.kernel.org/netdev/20261102110907.356621-2-u.kleine-koenig@baylibre.com (local)
. Changes since then:

 - keep the local header and make it self-contained
 - Do the simplifictions in the header instead of the folded-in copy
 
Note that while keeping the header is fine for me in principle, I still
consider it a bit ugly to have a variable defined in a header. OK, there
is only a single user, but if there were two or more, each user would
get its own copy of that variable. 🤷

Still this patch makes my mod_deviceid.h check script happy because now
the usage of pci_device_id doesn't depend on ena_netdev.c including
<linux/device-id/pci.h> before ena_pci_id_tbl.h.

Best regards
Uwe

 .../net/ethernet/amazon/ena/ena_pci_id_tbl.h  | 31 +++++--------------
 1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_pci_id_tbl.h b/drivers/net/ethernet/amazon/ena/ena_pci_id_tbl.h
index 3ecdf29160ca..72605991528c 100644
--- a/drivers/net/ethernet/amazon/ena/ena_pci_id_tbl.h
+++ b/drivers/net/ethernet/amazon/ena/ena_pci_id_tbl.h
@@ -6,39 +6,24 @@
 #ifndef ENA_PCI_ID_TBL_H_
 #define ENA_PCI_ID_TBL_H_
 
-#ifndef PCI_VENDOR_ID_AMAZON
-#define PCI_VENDOR_ID_AMAZON 0x1d0f
-#endif
+#include <linux/device-id/pci.h>
+#include <linux/pci_ids.h>
 
-#ifndef PCI_DEV_ID_ENA_PF
 #define PCI_DEV_ID_ENA_PF	0x0ec2
-#endif
-
-#ifndef PCI_DEV_ID_ENA_LLQ_PF
 #define PCI_DEV_ID_ENA_LLQ_PF	0x1ec2
-#endif
-
-#ifndef PCI_DEV_ID_ENA_VF
 #define PCI_DEV_ID_ENA_VF	0xec20
-#endif
-
-#ifndef PCI_DEV_ID_ENA_LLQ_VF
 #define PCI_DEV_ID_ENA_LLQ_VF	0xec21
-#endif
-
-#ifndef PCI_DEV_ID_ENA_RESRV0
 #define PCI_DEV_ID_ENA_RESRV0	0x0051
-#endif
 
 #define ENA_PCI_ID_TABLE_ENTRY(devid) \
-	{PCI_DEVICE(PCI_VENDOR_ID_AMAZON, devid)},
+	{ PCI_DEVICE(PCI_VENDOR_ID_AMAZON, devid) }
 
 static const struct pci_device_id ena_pci_tbl[] = {
-	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_RESRV0)
-	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_PF)
-	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_LLQ_PF)
-	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_VF)
-	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_LLQ_VF)
+	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_RESRV0),
+	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_PF),
+	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_LLQ_PF),
+	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_VF),
+	ENA_PCI_ID_TABLE_ENTRY(PCI_DEV_ID_ENA_LLQ_VF),
 	{ }
 };
 
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.56.0.rc1
Thread (2 messages) 2 messages, 2 authors, last reply 4d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help