summaryrefslogtreecommitdiffstats
path: root/include/driver.h
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2013-03-10 10:41:30 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-14 07:15:44 +0100
commit943e586fe69c8a80fed11d2e04e8e0afd875b61d (patch)
tree49c50b747efbc21449f86ca226db97a89891f980 /include/driver.h
parent2e7d66f526217f6ff3167e4580aecb9548a0de33 (diff)
downloadbarebox-943e586fe69c8a80fed11d2e04e8e0afd875b61d.tar.gz
barebox-943e586fe69c8a80fed11d2e04e8e0afd875b61d.tar.xz
Extend device_platform_driver macro
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@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/driver.h')
-rw-r--r--include/driver.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/driver.h b/include/driver.h
index 46c56c0acf..138eab4190 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) \
+#define register_driver_macro(level,bus,drv) \
+ static int __init drv##_register(void) \
{ \
- return platform_driver_register(&drv); \
+ return bus##_driver_register(&drv); \
} \
- device_initcall(drv ## _register)
+ level##_initcall(drv##_register)
+
+#define device_platform_driver(drv) \
+ register_driver_macro(device,platform,drv)
int platform_device_register(struct device_d *new_device);