git: 87e6f90667e5 - stable/14 - LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 13 Jul 2025 19:31:09 UTC
The branch stable/14 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=87e6f90667e5a841592d8a2522f90981fd3e3fff
commit 87e6f90667e5a841592d8a2522f90981fd3e3fff
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-06-22 22:50:33 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-07-13 19:25:03 +0000
LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO()
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus
attachments, factor out the bus-specfic MODULE_PNP_INFO() and place
it next to the structure defining the table.
As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with
PCI attachments for the "auxillary" bus so far. That makes little sense.
Define the MODULE_PNP_INFO() to nothing for that. We may consider
pulling these LinucKPI bits in semi-native drivers into LinuxKPI
one day as that route is not really sustainabke.
Sponsored by: The FreeBSD Foundation
Reviewed by: imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51049
(cherry picked from commit 2f5666c1727c949491f73e6c3277b7b542131714)
---
sys/compat/linuxkpi/common/include/linux/pci.h | 7 +++++--
sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 15fedb87e6e6..9d0725089269 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -70,6 +70,10 @@ struct pci_device_id {
uintptr_t driver_data;
};
+#define MODULE_DEVICE_TABLE_BUS_pci(_bus, _table) \
+MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \
+ _bus, lkpi_ ## _table, _table, nitems(_table) - 1)
+
/* Linux has an empty element at the end of the ID table -> nitems() - 1. */
#define MODULE_DEVICE_TABLE(_bus, _table) \
\
@@ -86,8 +90,7 @@ static driver_t _ ## _bus ## _ ## _table ## _driver = { \
DRIVER_MODULE(lkpi_ ## _table, _bus, _ ## _bus ## _ ## _table ## _driver,\
0, 0); \
\
-MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \
- _bus, lkpi_ ## _table, _table, nitems(_table) - 1)
+MODULE_DEVICE_TABLE_BUS_ ## _bus(_bus, _table)
#define PCI_ANY_ID -1U
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h b/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h
index 1d844a67c928..c4c9e789cf3e 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h
+++ b/sys/dev/bnxt/bnxt_en/bnxt_auxbus_compat.h
@@ -39,6 +39,7 @@ struct auxiliary_device_id {
char name[AUXILIARY_NAME_SIZE];
uint64_t driver_data;
};
+#define MODULE_DEVICE_TABLE_BUS_auxiliary(_bus, _table)
struct auxiliary_device {
struct device dev;