git: db221468b09a - main - EARLY_DRIVER_MODULE: use designated initializers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Jan 2025 20:31:07 UTC
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=db221468b09ac8b57fa6ec8c142fdde8d5d4beeb
commit db221468b09ac8b57fa6ec8c142fdde8d5d4beeb
Author: Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2025-01-23 20:29:27 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2025-01-23 20:30:31 +0000
EARLY_DRIVER_MODULE: use designated initializers
It helps the reader to parse the macro definition, with respect to how
the arguments are mapped to the structure members. No functional change
intended.
Reviewed by: imp, jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48489
---
sys/sys/bus.h | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 067868da4367..8b32e10f1285 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -851,24 +851,25 @@ struct driver_module_data {
int dmd_pass;
};
-#define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, evh, arg, \
+#define EARLY_DRIVER_MODULE_ORDERED(_name, busname, driver, evh, arg, \
order, pass) \
\
-static struct driver_module_data name##_##busname##_driver_mod = { \
- evh, arg, \
- #busname, \
- (kobj_class_t) &driver, \
- NULL, \
- pass \
+static struct driver_module_data _name##_##busname##_driver_mod = { \
+ .dmd_chainevh = evh, \
+ .dmd_chainarg = arg, \
+ .dmd_busname = #busname, \
+ .dmd_driver = (kobj_class_t)&driver, \
+ .dmd_devclass = NULL, \
+ .dmd_pass = pass, \
}; \
\
-static moduledata_t name##_##busname##_mod = { \
- #busname "/" #name, \
- driver_module_handler, \
- &name##_##busname##_driver_mod \
+static moduledata_t _name##_##busname##_mod = { \
+ .name = #busname "/" #_name , \
+ .evhand = driver_module_handler, \
+ .priv = &_name##_##busname##_driver_mod, \
}; \
-DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \
- SI_SUB_DRIVERS, order)
+DECLARE_MODULE(_name##_##busname, _name##_##busname##_mod, \
+ SI_SUB_DRIVERS, order)
#define EARLY_DRIVER_MODULE(name, busname, driver, evh, arg, pass) \
EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, evh, arg, \