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

* [PATCH v2 2/6] Add more drivers to using device_platform_driver()
  2013-03-10  6:41 [PATCH v2 1/6] Extend device_platform_driver macro Alexander Shiyan
@ 2013-03-10  6:41 ` Alexander Shiyan
  2013-03-10  6:41 ` [PATCH v2 3/6] Introduce console_platform_driver() macro and use it for serial drivers Alexander Shiyan
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-03-10  6:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/net/xgmac.c   | 8 +-------
 drivers/spi/mxs_spi.c | 8 +-------
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/net/xgmac.c b/drivers/net/xgmac.c
index 203e682..b4bfd08 100644
--- a/drivers/net/xgmac.c
+++ b/drivers/net/xgmac.c
@@ -731,10 +731,4 @@ static struct driver_d hb_xgmac_driver = {
 	.probe = hb_xgmac_probe,
 	.of_compatible = DRV_OF_COMPAT(xgmac_dt_ids),
 };
-
-static int hb_xgmac_driver_init(void)
-{
-	debug("%s\n", __func__);
-	return platform_driver_register(&hb_xgmac_driver);
-}
-device_initcall(hb_xgmac_driver_init);
+device_platform_driver(hb_xgmac_driver);
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 89b4d19..e15f2c2 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -276,13 +276,7 @@ static struct driver_d mxs_spi_driver = {
 	.name  = "mxs_spi",
 	.probe = mxs_spi_probe,
 };
-
-static int __init mxs_spi_init(void)
-{
-	return platform_driver_register(&mxs_spi_driver);
-}
-
-device_initcall(mxs_spi_init);
+device_platform_driver(mxs_spi_driver);
 
 MODULE_AUTHOR("Denx Software Engeneering and Michael Grzeschik");
 MODULE_DESCRIPTION("MXS SPI driver");
-- 
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

* [PATCH v2 3/6] Introduce console_platform_driver() macro and use it for serial drivers
  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 ` Alexander Shiyan
  2013-03-10  6:41 ` [PATCH v2 4/6] SPI: Rename spi_register_driver() for using with register_driver_macro() Alexander Shiyan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-03-10  6:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/serial/arm_dcc.c              |  6 ++----
 drivers/serial/atmel.c                |  9 +--------
 drivers/serial/linux_console.c        |  9 +--------
 drivers/serial/serial_altera.c        |  9 +--------
 drivers/serial/serial_altera_jtag.c   |  8 +-------
 drivers/serial/serial_auart.c         |  9 +--------
 drivers/serial/serial_blackfin.c      | 10 +---------
 drivers/serial/serial_clps711x.c      |  7 +------
 drivers/serial/serial_imx.c           |  9 +--------
 drivers/serial/serial_mpc5xxx.c       |  9 +--------
 drivers/serial/serial_netx.c          | 10 +---------
 drivers/serial/serial_ns16550.c       | 13 +------------
 drivers/serial/serial_omap4_usbboot.c |  7 +------
 drivers/serial/serial_pl010.c         | 10 +---------
 drivers/serial/serial_pxa.c           |  8 +-------
 drivers/serial/serial_s3c.c           |  9 +--------
 drivers/serial/stm-serial.c           |  9 +--------
 include/driver.h                      |  2 ++
 18 files changed, 20 insertions(+), 133 deletions(-)

diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
index e82218a..bab7299 100644
--- a/drivers/serial/arm_dcc.c
+++ b/drivers/serial/arm_dcc.c
@@ -149,6 +149,7 @@ static struct driver_d arm_dcc_driver = {
 	.name	= "arm_dcc",
 	.probe	= arm_dcc_probe,
 };
+console_platform_driver(arm_dcc_driver);
 
 static struct device_d arm_dcc_device = {
 	.id	= DEVICE_ID_DYNAMIC,
@@ -157,9 +158,6 @@ static struct device_d arm_dcc_device = {
 
 static int arm_dcc_init(void)
 {
-	platform_device_register(&arm_dcc_device);
-	platform_driver_register(&arm_dcc_driver);
-	return 0;
+	return platform_device_register(&arm_dcc_device);
 }
-
 console_initcall(arm_dcc_init);
diff --git a/drivers/serial/atmel.c b/drivers/serial/atmel.c
index 6beae25..89c141e 100644
--- a/drivers/serial/atmel.c
+++ b/drivers/serial/atmel.c
@@ -418,11 +418,4 @@ static struct driver_d atmel_serial_driver = {
         .name  = "atmel_usart",
         .probe = atmel_serial_probe,
 };
-
-static int atmel_serial_init(void)
-{
-	platform_driver_register(&atmel_serial_driver);
-	return 0;
-}
-
-console_initcall(atmel_serial_init);
+console_platform_driver(atmel_serial_driver);
diff --git a/drivers/serial/linux_console.c b/drivers/serial/linux_console.c
index 4a99e96..7ded091 100644
--- a/drivers/serial/linux_console.c
+++ b/drivers/serial/linux_console.c
@@ -78,11 +78,4 @@ static struct driver_d linux_console_driver = {
         .name  = "console",
         .probe = linux_console_probe,
 };
-
-static int console_init(void)
-{
-	return platform_driver_register(&linux_console_driver);
-}
-
-console_initcall(console_init);
-
+console_platform_driver(linux_console_driver);
diff --git a/drivers/serial/serial_altera.c b/drivers/serial/serial_altera.c
index 013b32c..7ff38d7 100644
--- a/drivers/serial/serial_altera.c
+++ b/drivers/serial/serial_altera.c
@@ -101,11 +101,4 @@ static struct driver_d altera_serial_driver = {
 	.name = "altera_serial",
 	.probe = altera_serial_probe,
 };
-
-static int altera_serial_init(void)
-{
-	return platform_driver_register(&altera_serial_driver);
-}
-
-console_initcall(altera_serial_init);
-
+console_platform_driver(altera_serial_driver);
diff --git a/drivers/serial/serial_altera_jtag.c b/drivers/serial/serial_altera_jtag.c
index b83fcbd..edc3c76 100644
--- a/drivers/serial/serial_altera_jtag.c
+++ b/drivers/serial/serial_altera_jtag.c
@@ -106,10 +106,4 @@ static struct driver_d altera_serial_jtag_driver = {
 	.name = "altera_serial_jtag",
 	.probe = altera_serial_jtag_probe,
 };
-
-static int altera_serial_jtag_init(void)
-{
-	return platform_driver_register(&altera_serial_jtag_driver);
-}
-
-console_initcall(altera_serial_jtag_init);
+console_platform_driver(altera_serial_jtag_driver);
diff --git a/drivers/serial/serial_auart.c b/drivers/serial/serial_auart.c
index fa2e04f..7c179fa 100644
--- a/drivers/serial/serial_auart.c
+++ b/drivers/serial/serial_auart.c
@@ -228,11 +228,4 @@ static struct driver_d auart_serial_driver = {
 	.probe = auart_serial_probe,
 	.remove = auart_serial_remove,
 };
-
-static int auart_serial_init(void)
-{
-	platform_driver_register(&auart_serial_driver);
-	return 0;
-}
-
-console_initcall(auart_serial_init);
+console_platform_driver(auart_serial_driver);
diff --git a/drivers/serial/serial_blackfin.c b/drivers/serial/serial_blackfin.c
index 2117b11..7373a03 100644
--- a/drivers/serial/serial_blackfin.c
+++ b/drivers/serial/serial_blackfin.c
@@ -130,12 +130,4 @@ static struct driver_d blackfin_serial_driver = {
         .name  = "blackfin_serial",
         .probe = blackfin_serial_probe,
 };
-
-static int blackfin_serial_init(void)
-{
-	platform_driver_register(&blackfin_serial_driver);
-	return 0;
-}
-
-console_initcall(blackfin_serial_init);
-
+console_platform_driver(blackfin_serial_driver);
diff --git a/drivers/serial/serial_clps711x.c b/drivers/serial/serial_clps711x.c
index 21d0b55..c359741 100644
--- a/drivers/serial/serial_clps711x.c
+++ b/drivers/serial/serial_clps711x.c
@@ -149,9 +149,4 @@ static struct driver_d clps711x_driver = {
 	.probe	= clps711x_probe,
 	.remove	= clps711x_remove,
 };
-
-static int clps711x_init(void)
-{
-	return platform_driver_register(&clps711x_driver);
-}
-console_initcall(clps711x_init);
+console_platform_driver(clps711x_driver);
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 3f219ae..8553c2e 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -397,11 +397,4 @@ static struct driver_d imx_serial_driver = {
 	.of_compatible = DRV_OF_COMPAT(imx_serial_dt_ids),
 	.id_table = imx_serial_ids,
 };
-
-static int imx_serial_init(void)
-{
-	platform_driver_register(&imx_serial_driver);
-	return 0;
-}
-
-console_initcall(imx_serial_init);
+console_platform_driver(imx_serial_driver);
diff --git a/drivers/serial/serial_mpc5xxx.c b/drivers/serial/serial_mpc5xxx.c
index 81eaf07..532eea3 100644
--- a/drivers/serial/serial_mpc5xxx.c
+++ b/drivers/serial/serial_mpc5xxx.c
@@ -166,11 +166,4 @@ static struct driver_d mpc5xxx_serial_driver = {
         .name  = "mpc5xxx_serial",
         .probe = mpc5xxx_serial_probe,
 };
-
-static int mpc5xxx_serial_register(void)
-{
-	platform_driver_register(&mpc5xxx_serial_driver);
-	return 0;
-}
-
-console_initcall(mpc5xxx_serial_register);
+console_platform_driver(mpc5xxx_serial_driver);
diff --git a/drivers/serial/serial_netx.c b/drivers/serial/serial_netx.c
index 2ad9cfa..037b998 100644
--- a/drivers/serial/serial_netx.c
+++ b/drivers/serial/serial_netx.c
@@ -155,12 +155,4 @@ static struct driver_d netx_serial_driver = {
         .name  = "netx_serial",
         .probe = netx_serial_probe,
 };
-
-static int netx_serial_init(void)
-{
-	platform_driver_register(&netx_serial_driver);
-	return 0;
-}
-
-console_initcall(netx_serial_init);
-
+console_platform_driver(netx_serial_driver);
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 0ea940d..b7913aa 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -262,15 +262,4 @@ static struct driver_d ns16550_serial_driver = {
 	.name = "ns16550_serial",
 	.probe = ns16550_probe,
 };
-
-/**
- * @brief driver initialization function
- *
- * @return result of platform_driver_register
- */
-static int ns16550_serial_init(void)
-{
-	return platform_driver_register(&ns16550_serial_driver);
-}
-
-console_initcall(ns16550_serial_init);
+console_platform_driver(ns16550_serial_driver);
diff --git a/drivers/serial/serial_omap4_usbboot.c b/drivers/serial/serial_omap4_usbboot.c
index f0a2fd1..51b2d13 100644
--- a/drivers/serial/serial_omap4_usbboot.c
+++ b/drivers/serial/serial_omap4_usbboot.c
@@ -75,9 +75,4 @@ static struct driver_d serial_omap4_usbboot_driver = {
 	.name = "serial_omap4_usbboot",
 	.probe = serial_omap4_usbboot_probe,
 };
-
-static int serial_omap4_usbboot_init(void)
-{
-	return platform_driver_register(&serial_omap4_usbboot_driver);
-}
-console_initcall(serial_omap4_usbboot_init);
+console_platform_driver(serial_omap4_usbboot_driver);
diff --git a/drivers/serial/serial_pl010.c b/drivers/serial/serial_pl010.c
index 0526b00..9158774 100644
--- a/drivers/serial/serial_pl010.c
+++ b/drivers/serial/serial_pl010.c
@@ -157,12 +157,4 @@ static struct driver_d pl010_driver = {
 	.name  = "pl010_serial",
 	.probe = pl010_probe,
 };
-
-static int pl010_init(void)
-{
-	platform_driver_register(&pl010_driver);
-
-	return 0;
-}
-
-console_initcall(pl010_init);
+console_platform_driver(pl010_driver);
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 08f3d7f..42355ce 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -195,10 +195,4 @@ static struct driver_d pxa_serial_driver = {
 	.probe = pxa_serial_probe,
 	.remove = pxa_serial_remove,
 };
-
-static int pxa_serial_init(void)
-{
-	return platform_driver_register(&pxa_serial_driver);
-}
-
-console_initcall(pxa_serial_init);
+console_platform_driver(pxa_serial_driver);
diff --git a/drivers/serial/serial_s3c.c b/drivers/serial/serial_s3c.c
index ed401ab..cc7b33e 100644
--- a/drivers/serial/serial_s3c.c
+++ b/drivers/serial/serial_s3c.c
@@ -213,11 +213,4 @@ static struct driver_d s3c_serial_driver = {
 	.probe  = s3c_serial_probe,
 	.remove = s3c_serial_remove,
 };
-
-static int s3c_serial_init(void)
-{
-	platform_driver_register(&s3c_serial_driver);
-	return 0;
-}
-
-console_initcall(s3c_serial_init);
+console_platform_driver(s3c_serial_driver);
diff --git a/drivers/serial/stm-serial.c b/drivers/serial/stm-serial.c
index 3968892..49ffb2c 100644
--- a/drivers/serial/stm-serial.c
+++ b/drivers/serial/stm-serial.c
@@ -187,11 +187,4 @@ static struct driver_d stm_serial_driver = {
         .probe  = stm_serial_probe,
 	.remove = stm_serial_remove,
 };
-
-static int stm_serial_init(void)
-{
-	platform_driver_register(&stm_serial_driver);
-	return 0;
-}
-
-console_initcall(stm_serial_init);
+console_platform_driver(stm_serial_driver);
diff --git a/include/driver.h b/include/driver.h
index 138eab4..8598a39 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -408,6 +408,8 @@ int platform_driver_register(struct driver_d *drv);
 
 #define device_platform_driver(drv)	\
 	register_driver_macro(device,platform,drv)
+#define console_platform_driver(drv)	\
+	register_driver_macro(console,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

* [PATCH v2 4/6] SPI: Rename spi_register_driver() for using with register_driver_macro()
  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 ` 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
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-03-10  6:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/eeprom/at25.c               | 2 +-
 drivers/mci/mci_spi.c               | 2 +-
 drivers/mfd/mc13xxx.c               | 2 +-
 drivers/mfd/mc34708.c               | 2 +-
 drivers/mtd/devices/m25p80.c        | 2 +-
 drivers/mtd/devices/mtd_dataflash.c | 2 +-
 drivers/net/ksz8864rmn.c            | 2 +-
 include/spi/spi.h                   | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index 9bd7748..e2e6ef4 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -307,7 +307,7 @@ static struct driver_d at25_driver = {
 
 static int at25_init(void)
 {
-	spi_register_driver(&at25_driver);
+	spi_driver_register(&at25_driver);
 	return 0;
 }
 
diff --git a/drivers/mci/mci_spi.c b/drivers/mci/mci_spi.c
index 679a0e1..022e260 100644
--- a/drivers/mci/mci_spi.c
+++ b/drivers/mci/mci_spi.c
@@ -446,7 +446,7 @@ static struct driver_d spi_mci_driver = {
 
 static int spi_mci_init_driver(void)
 {
-	spi_register_driver(&spi_mci_driver);
+	spi_driver_register(&spi_mci_driver);
 	return 0;
 }
 
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index d6cf73c..359b118 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -375,7 +375,7 @@ static struct driver_d mc_spi_driver = {
 
 static int mc_spi_init(void)
 {
-	return spi_register_driver(&mc_spi_driver);
+	return spi_driver_register(&mc_spi_driver);
 }
 
 device_initcall(mc_spi_init);
diff --git a/drivers/mfd/mc34708.c b/drivers/mfd/mc34708.c
index b1166de..fbd6891 100644
--- a/drivers/mfd/mc34708.c
+++ b/drivers/mfd/mc34708.c
@@ -294,7 +294,7 @@ static struct driver_d mc_spi_driver = {
 
 static int mc_spi_init(void)
 {
-	return spi_register_driver(&mc_spi_driver);
+	return spi_driver_register(&mc_spi_driver);
 }
 
 device_initcall(mc_spi_init);
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 2db6fff..3293491 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -954,7 +954,7 @@ static struct driver_d m25p80_driver = {
 
 static int m25p80_init(void)
 {
-	return spi_register_driver(&m25p80_driver);
+	return spi_driver_register(&m25p80_driver);
 }
 device_initcall(m25p80_init);
 
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 3b7b9c6..cfad8b1 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -878,7 +878,7 @@ static struct driver_d dataflash_driver = {
 
 static int dataflash_init(void)
 {
-	spi_register_driver(&dataflash_driver);
+	spi_driver_register(&dataflash_driver);
 	return 0;
 }
 device_initcall(dataflash_init);
diff --git a/drivers/net/ksz8864rmn.c b/drivers/net/ksz8864rmn.c
index 5845960..99274ec 100644
--- a/drivers/net/ksz8864rmn.c
+++ b/drivers/net/ksz8864rmn.c
@@ -185,7 +185,7 @@ static struct driver_d micrel_switch_driver = {
 
 static int micrel_switch_init(void)
 {
-	spi_register_driver(&micrel_switch_driver);
+	spi_driver_register(&micrel_switch_driver);
 	return 0;
 }
 device_initcall(micrel_switch_init);
diff --git a/include/spi/spi.h b/include/spi/spi.h
index fa76e9b..9bec566 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -436,7 +436,7 @@ extern struct bus_type spi_bus;
 
 struct spi_master *spi_get_master(int bus);
 
-static inline int spi_register_driver(struct driver_d *drv)
+static inline int spi_driver_register(struct driver_d *drv)
 {
 	drv->bus = &spi_bus;
 	return register_driver(drv);
-- 
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

* [PATCH v2 5/6] I2C: Rename i2c_register_driver() for using with register_driver_macro()
  2013-03-10  6:41 [PATCH v2 1/6] Extend device_platform_driver macro Alexander Shiyan
                   ` (2 preceding siblings ...)
  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 ` Alexander Shiyan
  2013-03-10  6:41 ` [PATCH v2 6/6] Introduce device_spi_driver() macro and use it for SPI drivers Alexander Shiyan
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-03-10  6:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/eeprom/at24.c   | 2 +-
 drivers/input/qt1070.c  | 2 +-
 drivers/mfd/lp3972.c    | 2 +-
 drivers/mfd/mc13xxx.c   | 2 +-
 drivers/mfd/mc34704.c   | 2 +-
 drivers/mfd/mc34708.c   | 2 +-
 drivers/mfd/mc9sdz60.c  | 2 +-
 drivers/mfd/stmpe-i2c.c | 2 +-
 drivers/mfd/twl4030.c   | 2 +-
 drivers/mfd/twl6030.c   | 2 +-
 include/i2c/i2c.h       | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c
index 6f0133a..4b2afc4 100644
--- a/drivers/eeprom/at24.c
+++ b/drivers/eeprom/at24.c
@@ -454,7 +454,7 @@ static struct driver_d at24_driver = {
 
 static int at24_init(void)
 {
-	i2c_register_driver(&at24_driver);
+	i2c_driver_register(&at24_driver);
 	return 0;
 }
 device_initcall(at24_init);
diff --git a/drivers/input/qt1070.c b/drivers/input/qt1070.c
index ebe2b81..43ea882 100644
--- a/drivers/input/qt1070.c
+++ b/drivers/input/qt1070.c
@@ -291,7 +291,7 @@ static struct driver_d qt1070_driver = {
 
 static int qt1070_init(void)
 {
-	i2c_register_driver(&qt1070_driver);
+	i2c_driver_register(&qt1070_driver);
 	return 0;
 }
 device_initcall(qt1070_init);
diff --git a/drivers/mfd/lp3972.c b/drivers/mfd/lp3972.c
index 082ecaa..ee794df 100644
--- a/drivers/mfd/lp3972.c
+++ b/drivers/mfd/lp3972.c
@@ -99,7 +99,7 @@ static struct driver_d lp_driver = {
 
 static int lp_init(void)
 {
-	i2c_register_driver(&lp_driver);
+	i2c_driver_register(&lp_driver);
 	return 0;
 }
 
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index 359b118..91c874f 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -356,7 +356,7 @@ static struct driver_d mc_i2c_driver = {
 
 static int mc_i2c_init(void)
 {
-	return i2c_register_driver(&mc_i2c_driver);
+	return i2c_driver_register(&mc_i2c_driver);
 }
 device_initcall(mc_i2c_init);
 #endif
diff --git a/drivers/mfd/mc34704.c b/drivers/mfd/mc34704.c
index 276b723..9afab07 100644
--- a/drivers/mfd/mc34704.c
+++ b/drivers/mfd/mc34704.c
@@ -130,7 +130,7 @@ static struct driver_d mc34704_driver = {
 
 static int mc34704_init(void)
 {
-	i2c_register_driver(&mc34704_driver);
+	i2c_driver_register(&mc34704_driver);
 	return 0;
 }
 device_initcall(mc34704_init);
diff --git a/drivers/mfd/mc34708.c b/drivers/mfd/mc34708.c
index fbd6891..63db1e1 100644
--- a/drivers/mfd/mc34708.c
+++ b/drivers/mfd/mc34708.c
@@ -275,7 +275,7 @@ static struct driver_d mc_i2c_driver = {
 
 static int mc_i2c_init(void)
 {
-	return i2c_register_driver(&mc_i2c_driver);
+	return i2c_driver_register(&mc_i2c_driver);
 }
 
 device_initcall(mc_i2c_init);
diff --git a/drivers/mfd/mc9sdz60.c b/drivers/mfd/mc9sdz60.c
index 76c62e3..0d2c56b 100644
--- a/drivers/mfd/mc9sdz60.c
+++ b/drivers/mfd/mc9sdz60.c
@@ -142,7 +142,7 @@ static struct driver_d mc_driver = {
 
 static int mc_init(void)
 {
-        i2c_register_driver(&mc_driver);
+        i2c_driver_register(&mc_driver);
         return 0;
 }
 
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index 9e4bbcc..d87620e 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -147,7 +147,7 @@ static struct driver_d stmpe_driver = {
 
 static int stmpe_init(void)
 {
-        i2c_register_driver(&stmpe_driver);
+        i2c_driver_register(&stmpe_driver);
         return 0;
 }
 
diff --git a/drivers/mfd/twl4030.c b/drivers/mfd/twl4030.c
index 9309765..3b4c661 100644
--- a/drivers/mfd/twl4030.c
+++ b/drivers/mfd/twl4030.c
@@ -53,7 +53,7 @@ static struct driver_d twl_driver = {
 
 static int twl_init(void)
 {
-	i2c_register_driver(&twl_driver);
+	i2c_driver_register(&twl_driver);
 	return 0;
 }
 
diff --git a/drivers/mfd/twl6030.c b/drivers/mfd/twl6030.c
index 6b872ab..0645d3c 100644
--- a/drivers/mfd/twl6030.c
+++ b/drivers/mfd/twl6030.c
@@ -70,7 +70,7 @@ static struct driver_d twl_driver = {
 
 static int twl_init(void)
 {
-	i2c_register_driver(&twl_driver);
+	i2c_driver_register(&twl_driver);
 	return 0;
 }
 
diff --git a/include/i2c/i2c.h b/include/i2c/i2c.h
index dc5e5fc..7b59a51 100644
--- a/include/i2c/i2c.h
+++ b/include/i2c/i2c.h
@@ -151,7 +151,7 @@ extern int i2c_write_reg(struct i2c_client *client, u32 addr, const u8 *buf, u16
 
 extern struct bus_type i2c_bus;
 
-static inline int i2c_register_driver(struct driver_d *drv)
+static inline int i2c_driver_register(struct driver_d *drv)
 {
 	drv->bus = &i2c_bus;
 	return register_driver(drv);
-- 
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

* [PATCH v2 6/6] Introduce device_spi_driver() macro and use it for SPI drivers
  2013-03-10  6:41 [PATCH v2 1/6] Extend device_platform_driver macro Alexander Shiyan
                   ` (3 preceding siblings ...)
  2013-03-10  6:41 ` [PATCH v2 5/6] I2C: Rename i2c_register_driver() " Alexander Shiyan
@ 2013-03-10  6:41 ` Alexander Shiyan
  4 siblings, 0 replies; 6+ messages in thread
From: Alexander Shiyan @ 2013-03-10  6:41 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/eeprom/at25.c               | 9 +--------
 drivers/mci/mci_spi.c               | 9 +--------
 drivers/mfd/mc13xxx.c               | 8 +-------
 drivers/mfd/mc34708.c               | 8 +-------
 drivers/mtd/devices/m25p80.c        | 7 +------
 drivers/mtd/devices/mtd_dataflash.c | 8 +-------
 drivers/net/ksz8864rmn.c            | 8 +-------
 include/spi/spi.h                   | 3 +++
 8 files changed, 10 insertions(+), 50 deletions(-)

diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index e2e6ef4..68b4710 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -304,11 +304,4 @@ static struct driver_d at25_driver = {
 	.name  = DRIVERNAME,
 	.probe = at25_probe,
 };
-
-static int at25_init(void)
-{
-	spi_driver_register(&at25_driver);
-	return 0;
-}
-
-device_initcall(at25_init);
+device_spi_driver(at25_driver);
diff --git a/drivers/mci/mci_spi.c b/drivers/mci/mci_spi.c
index 022e260..011947c 100644
--- a/drivers/mci/mci_spi.c
+++ b/drivers/mci/mci_spi.c
@@ -443,11 +443,4 @@ static struct driver_d spi_mci_driver = {
 	.name	= "spi_mci",
 	.probe	= spi_mci_probe,
 };
-
-static int spi_mci_init_driver(void)
-{
-	spi_driver_register(&spi_mci_driver);
-	return 0;
-}
-
-device_initcall(spi_mci_init_driver);
+device_spi_driver(spi_mci_driver);
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index 91c874f..466a11c 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -372,11 +372,5 @@ static struct driver_d mc_spi_driver = {
 	.probe = mc_spi_probe,
 	.of_compatible = DRV_OF_COMPAT(mc13892_dt_ids),
 };
-
-static int mc_spi_init(void)
-{
-	return spi_driver_register(&mc_spi_driver);
-}
-
-device_initcall(mc_spi_init);
+device_spi_driver(mc_spi_driver);
 #endif
diff --git a/drivers/mfd/mc34708.c b/drivers/mfd/mc34708.c
index 63db1e1..6fea2e2 100644
--- a/drivers/mfd/mc34708.c
+++ b/drivers/mfd/mc34708.c
@@ -291,11 +291,5 @@ static struct driver_d mc_spi_driver = {
 	.name  = "mc34708-spi",
 	.probe = mc_spi_probe,
 };
-
-static int mc_spi_init(void)
-{
-	return spi_driver_register(&mc_spi_driver);
-}
-
-device_initcall(mc_spi_init);
+device_spi_driver(mc_spi_driver);
 #endif
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 3293491..048d178 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -951,12 +951,7 @@ static struct driver_d m25p80_driver = {
 	.name	= "m25p80",
 	.probe	= m25p_probe,
 };
-
-static int m25p80_init(void)
-{
-	return spi_driver_register(&m25p80_driver);
-}
-device_initcall(m25p80_init);
+device_spi_driver(m25p80_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mike Lavender");
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index cfad8b1..ddab6bb 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -875,13 +875,7 @@ static struct driver_d dataflash_driver = {
 	.name  = "mtd_dataflash",
 	.probe = dataflash_probe,
 };
-
-static int dataflash_init(void)
-{
-	spi_driver_register(&dataflash_driver);
-	return 0;
-}
-device_initcall(dataflash_init);
+device_spi_driver(dataflash_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrew Victor, David Brownell");
diff --git a/drivers/net/ksz8864rmn.c b/drivers/net/ksz8864rmn.c
index 99274ec..af3c124 100644
--- a/drivers/net/ksz8864rmn.c
+++ b/drivers/net/ksz8864rmn.c
@@ -182,10 +182,4 @@ static struct driver_d micrel_switch_driver = {
 	.name  = "ksz8864rmn",
 	.probe = micrel_switch_probe,
 };
-
-static int micrel_switch_init(void)
-{
-	spi_driver_register(&micrel_switch_driver);
-	return 0;
-}
-device_initcall(micrel_switch_init);
+device_spi_driver(micrel_switch_driver);
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 9bec566..3da13e8 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -442,6 +442,9 @@ static inline int spi_driver_register(struct driver_d *drv)
 	return register_driver(drv);
 }
 
+#define device_spi_driver(drv)	\
+	register_driver_macro(device,spi,drv)
+
 void spi_of_register_slaves(struct spi_master *master, struct device_node *node);
 
 #endif /* __INCLUDE_SPI_H */
-- 
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