kernel/freebsd: fix module build on FreeBSD 14
Checks
Commit Message
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>
---
kernel/freebsd/nic_uio/nic_uio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, December 19, 2023 7:30 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH] kernel/freebsd: fix module build on FreeBSD 14
>
> 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>
> > 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
Id -> ID
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Tested-by: Daxue Gao <daxuex.gao@intel.com>
+Cc: stable@dpdk.org
Applied, thanks.
@@ -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,