mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH v2 6/6] Introduce device_spi_driver() macro and use it for SPI drivers
Date: Sun, 10 Mar 2013 10:41:35 +0400	[thread overview]
Message-ID: <1362897695-3936-6-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1362897695-3936-1-git-send-email-shc_work@mail.ru>


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

      parent reply	other threads:[~2013-03-10  6:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Alexander Shiyan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362897695-3936-6-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox