mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/6] Extend device_platform_driver macro
@ 2013-03-10  6:41 Alexander Shiyan
  2013-03-10  6:41 ` [PATCH v2 2/6] Add more drivers to using device_platform_driver() Alexander Shiyan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-03-10  6:41 UTC (permalink / raw)
  To: barebox

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>
---
 include/driver.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/driver.h b/include/driver.h
index 46c56c0..138eab4 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);
 
-- 
1.7.12.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-10  6:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-10  6:41 [PATCH v2 1/6] Extend device_platform_driver macro Alexander Shiyan
2013-03-10  6:41 ` [PATCH v2 2/6] Add more drivers to using device_platform_driver() Alexander Shiyan
2013-03-10  6:41 ` [PATCH v2 3/6] Introduce console_platform_driver() macro and use it for serial drivers Alexander Shiyan
2013-03-10  6:41 ` [PATCH v2 4/6] SPI: Rename spi_register_driver() for using with register_driver_macro() Alexander Shiyan
2013-03-10  6:41 ` [PATCH v2 5/6] I2C: Rename i2c_register_driver() " Alexander Shiyan
2013-03-10  6:41 ` [PATCH v2 6/6] Introduce device_spi_driver() macro and use it for SPI drivers Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox