summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2013-02-12 22:08:56 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2013-02-13 09:23:28 +0100
commit12ff7635353503e90ffbfe2f69436e4725a64b50 (patch)
treecbfb08bfd75f4c9be70bbef61d3322b0c25d852d
parente0946e79c94716801eec387941057ca1be1aafa7 (diff)
downloadbarebox-12ff7635353503e90ffbfe2f69436e4725a64b50.tar.gz
barebox-12ff7635353503e90ffbfe2f69436e4725a64b50.tar.xz
Introduce device_platform_driver() macro
device_platform_driver() - Helper macro for drivers that don't do anything special in module registration. This eliminates a lot of boilerplate. Driver registration will called on device_initcall. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/driver.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h
index 31f5d69848..151829ef05 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -390,6 +390,18 @@ extern struct list_head bus_list;
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
+ * 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)
+
int platform_device_register(struct device_d *new_device);
struct file_operations {