diff --git a/share/man/man9/DRIVER_MODULE.9 b/share/man/man9/DRIVER_MODULE.9 --- a/share/man/man9/DRIVER_MODULE.9 +++ b/share/man/man9/DRIVER_MODULE.9 @@ -42,10 +42,10 @@ .In sys/kernel.h .In sys/bus.h .In sys/module.h -.Fn DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" -.Fn DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "int order" -.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "int pass" -.Fn EARLY_DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass" +.Fn DRIVER_MODULE name busname "driver_t driver" "modeventhand_t evh" "void *arg" +.Fn DRIVER_MODULE_ORDERED name busname "driver_t driver" "modeventhand_t evh" "void *arg" "int order" +.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "modeventhand_t evh" "void *arg" "int pass" +.Fn EARLY_DRIVER_MODULE_ORDERED name busname "driver_t driver" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass" .Sh DESCRIPTION The .Fn DRIVER_MODULE @@ -74,9 +74,9 @@ using the same driver on the same or different buses. For example, the following is allowed: .Pp -.Fn DRIVER_MODULE foo isa foo_driver foo_devclass NULL NULL ; +.Fn DRIVER_MODULE foo isa foo_driver NULL NULL ; .Pp -.Fn DRIVER_MODULE foo pci foo_driver foo_devclass NULL NULL ; +.Fn DRIVER_MODULE foo pci foo_driver NULL NULL ; .Pp .Fa driver is the driver of type @@ -86,11 +86,6 @@ .Fn DRIVER_MODULE . .Pp The -.Fa devclass -argument contains the kernel-internal information about the device, -which will be used within the kernel driver module. -.Pp -The .Fa evh argument is the event handler which is called when the driver (or module) is loaded or unloaded (see @@ -146,6 +141,13 @@ .Xr module 9 , .Xr MODULE_PNP_INFO 9 , .Xr SYSINIT 9 +.Sh HISTORY +Prior to +.Fx 14.0 , +these macros accepted an additional +.Vt devclass_t +argument after +.Fa driver . .Sh AUTHORS This manual page was written by .An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/driver.9 b/share/man/man9/driver.9 --- a/share/man/man9/driver.9 +++ b/share/man/man9/driver.9 @@ -67,9 +67,7 @@ sizeof(struct foo_softc) }; -static devclass_t foo_devclass; - -DRIVER_MODULE(foo, bogo, foo_driver, foo_devclass, NULL, NULL); +DRIVER_MODULE(foo, bogo, foo_driver, NULL, NULL); .Ed .Sh DESCRIPTION Each driver in the kernel is described by a diff --git a/sys/sys/bus.h b/sys/sys/bus.h --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -800,14 +800,17 @@ int dmd_pass; }; -#define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ +#define _DRIVER_MODULE_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, NAME, ...) \ + NAME + +#define _EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ evh, arg, order, pass) \ \ static struct driver_module_data name##_##busname##_driver_mod = { \ evh, arg, \ #busname, \ (kobj_class_t) &driver, \ - &devclass, \ + devclass, \ pass \ }; \ \ @@ -819,19 +822,58 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ SI_SUB_DRIVERS, order) -#define EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \ - EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ +#define EARLY_DRIVER_MODULE_ORDERED7(name, busname, driver, evh, arg, \ + order, pass) \ + _EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, NULL, evh, \ + arg, order, pass) + +#define EARLY_DRIVER_MODULE_ORDERED8(name, busname, driver, devclass, \ + evh, arg, order, pass) \ + _EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, &devclass, \ + evh, arg, order, pass) + +#define EARLY_DRIVER_MODULE_ORDERED(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, EARLY_DRIVER_MODULE_ORDERED8, \ + EARLY_DRIVER_MODULE_ORDERED7)(__VA_ARGS__) + +#define EARLY_DRIVER_MODULE7(name, busname, driver, devclass, evh, arg, pass) \ + EARLY_DRIVER_MODULE_ORDERED8(name, busname, driver, devclass, \ evh, arg, SI_ORDER_MIDDLE, pass) -#define DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\ +#define EARLY_DRIVER_MODULE6(name, busname, driver, evh, arg, pass) \ + EARLY_DRIVER_MODULE_ORDERED7(name, busname, driver, evh, arg, \ + SI_ORDER_MIDDLE, pass) + +#define EARLY_DRIVER_MODULE(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, INVALID, \ + EARLY_DRIVER_MODULE7, EARLY_DRIVER_MODULE6)(__VA_ARGS__) + +#define DRIVER_MODULE_ORDERED7(name, busname, driver, devclass, evh, arg,\ order) \ - EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ + EARLY_DRIVER_MODULE_ORDERED8(name, busname, driver, devclass, \ evh, arg, order, BUS_PASS_DEFAULT) -#define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \ - EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, \ +#define DRIVER_MODULE_ORDERED6(name, busname, driver, devclass, evh, arg,\ + order) \ + EARLY_DRIVER_MODULE_ORDERED7(name, busname, driver, evh, arg, \ + order, BUS_PASS_DEFAULT) + +#define DRIVER_MODULE_ORDERED(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, INVALID, \ + DRIVER_MODULE_ORDERED7, DRIVER_MODULE_ORDERED6)(__VA_ARGS__) + +#define DRIVER_MODULE6(name, busname, driver, devclass, evh, arg) \ + EARLY_DRIVER_MODULE7(name, busname, driver, devclass, evh, arg, \ BUS_PASS_DEFAULT) +#define DRIVER_MODULE5(name, busname, driver, evh, arg) \ + EARLY_DRIVER_MODULE6(name, busname, driver, evh, arg, \ + BUS_PASS_DEFAULT) + +#define DRIVER_MODULE(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, INVALID, INVALID, \ + DRIVER_MODULE6, DRIVER_MODULE5)(__VA_ARGS__) + /** * Generic ivar accessor generation macros for bus drivers */