The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2f5666c1727c949491f73e6c3277b7b542131714
commit 2f5666c1727c949491f73e6c3277b7b542131714 Author: Bjoern A. Zeeb <b...@freebsd.org> AuthorDate: 2025-06-22 22:50:33 +0000 Commit: Bjoern A. Zeeb <b...@freebsd.org> CommitDate: 2025-07-04 03:22:22 +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 MFC after: 3 days Reviewed by: imp, dumbbell Differential Revision: https://reviews.freebsd.org/D51049 --- 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 f8a0b2d84d41..af19829f1cbb 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -72,6 +72,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) \ \ @@ -88,8 +92,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;