Skip to content

Commit

Permalink
kernel/freebsd: fix module build on FreeBSD 14
Browse files Browse the repository at this point in the history
[ upstream commit 5eedf66ac0e5ce62cd333e523996c63a3c4c2c00 ]

When building nic_uio module on FreeBSD 14, a build error is given in
the DRIVER_MODULE macro:

nic_uio.c:84:81: error: too many arguments provided to function-like macro invocation
DRIVER_MODULE(nic_uio, pci, nic_uio_driver, nic_uio_devclass, nic_uio_modevent, 0);
                                                                                ^
On FreeBSD 14, the devclass parameter is dropped from the macro,
so we conditionally compile a different invocation
for BSD versions before/after v14.

Bugzilla ID: 1335

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Daxue Gao <daxuex.gao@intel.com>
  • Loading branch information
bruce-richardson authored and bluca committed Feb 27, 2024
1 parent 65973f7 commit 7d1744b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kernel/freebsd/nic_uio/nic_uio.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ struct pci_bdf {
uint32_t function;
};

static devclass_t nic_uio_devclass;

DEFINE_CLASS_0(nic_uio, nic_uio_driver, nic_uio_methods, sizeof(struct nic_uio_softc));

#if __FreeBSD_version < 1400000
static devclass_t nic_uio_devclass;
DRIVER_MODULE(nic_uio, pci, nic_uio_driver, nic_uio_devclass, nic_uio_modevent, 0);
#else
DRIVER_MODULE(nic_uio, pci, nic_uio_driver, nic_uio_modevent, 0);
#endif

static int
nic_uio_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr,
Expand Down

0 comments on commit 7d1744b

Please sign in to comment.