[PATCH] Extend device_platform_driver macro
Alexander Shiyan
shc_work at mail.ru
Fri Mar 8 04:05:14 EST 2013
This patch extends device_platform_driver macro, so now we allow
use it with various init levels and subsystems.
Signed-off-by: Alexander Shiyan <shc_work at mail.ru>
---
include/driver.h | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/include/driver.h b/include/driver.h
index 46c56c0..b891f80 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -395,16 +395,19 @@ extern struct bus_type platform_bus;
int platform_driver_register(struct driver_d *drv);
-/* device_platform_driver() - Helper macro for drivers that don't do
+/* register_driver_macro() - Helper macro for drivers that don't do
* anything special in module registration. This eliminates a lot of
* boilerplate. Each module may only use this macro once.
*/
-#define device_platform_driver(drv) \
- static int __init drv ## _register(void) \
- { \
- return platform_driver_register(&drv); \
- } \
- device_initcall(drv ## _register)
+#define register_driver_macro(level,subsystem,drv) \
+ static int __init drv##_register(void) \
+ { \
+ return subsystem##_driver_register(&drv); \
+ } \
+ level##_initcall(drv##_register)
+
+#define device_platform_driver(drv) \
+ register_driver_macro(device,platform,drv)
int platform_device_register(struct device_d *new_device);
--
1.7.12.4
More information about the barebox
mailing list