Skip to contentSkip to conversation

kernel/freebsd: fix module build on FreeBSD 14

PATCH Applied Bruce Richardson 3 participants 3 messages Dec 19, 2023 – Jan 31, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 kernel/freebsd/nic_uio/nic_uio.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/freebsd/nic_uio/nic_uio.c +6 -2
index 7a81694c92..0043892870 100644
@@ -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,
Signature · 1 line
2.42.0
Tested-by on v1 1/1
#1 lore raw
Quoted 17 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Tuesday, December 19, 2023 7:30 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>
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.

Quoted 3 lines

Bugzilla Id: 1335

#2 lore raw
Quoted 11 lines
Quoted 11 lines

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

Quoted 3 lines
Quoted 2 lines

+Cc: [email protected]

Applied, thanks.