mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/5] mfd mc13xxx: Separate I2C and SPI probe
Date: Tue, 11 Sep 2012 15:31:49 +0200	[thread overview]
Message-ID: <1347370313-15184-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1347370313-15184-1-git-send-email-s.hauer@pengutronix.de>

Upcoming patches will put I2C/SPI on their own busses with
spi_register_driver / i2c_register_driver which will only
be available if the subsystem is enabled. We could provide
static inlines, but it wouldn't make much sense to compile
a spi/i2c driver if the corresponding subsystem is disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mfd/mc13xxx.c |   28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index 704446d..58394a7 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -336,31 +336,39 @@ static int mc_probe(struct device_d *dev, enum mc13xxx_mode mode)
 	return 0;
 }
 
+#ifdef CONFIG_I2C
 static int mc_i2c_probe(struct device_d *dev)
 {
 	return mc_probe(dev, MC13XXX_MODE_I2C);
 }
 
-static int mc_spi_probe(struct device_d *dev)
-{
-	return mc_probe(dev, MC13XXX_MODE_SPI);
-}
-
 static struct driver_d mc_i2c_driver = {
 	.name  = "mc13xxx-i2c",
 	.probe = mc_i2c_probe,
 };
 
+static int mc_i2c_init(void)
+{
+	return register_driver(&mc_i2c_driver);
+}
+device_initcall(mc_i2c_init);
+#endif
+
+#ifdef CONFIG_SPI
+static int mc_spi_probe(struct device_d *dev)
+{
+	return mc_probe(dev, MC13XXX_MODE_SPI);
+}
+
 static struct driver_d mc_spi_driver = {
 	.name  = "mc13xxx-spi",
 	.probe = mc_spi_probe,
 };
 
-static int mc_init(void)
+static int mc_spi_init(void)
 {
-        register_driver(&mc_i2c_driver);
-        register_driver(&mc_spi_driver);
-        return 0;
+	return register_driver(&mc_spi_driver);
 }
 
-device_initcall(mc_init);
+device_initcall(mc_spi_init);
+#endif
-- 
1.7.10.4


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

  reply	other threads:[~2012-09-11 13:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 13:31 [PATCH] device/driver work Sascha Hauer
2012-09-11 13:31 ` Sascha Hauer [this message]
2012-09-11 13:31 ` [PATCH 2/5] SPI: Put SPI devices on their own bus bus Sascha Hauer
2012-09-11 14:03   ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-11 14:26     ` Sascha Hauer
2012-09-11 13:31 ` [PATCH 3/5] I2C: Put I2C devices on their own bus Sascha Hauer
2012-09-11 14:04   ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-11 14:27     ` Sascha Hauer
2012-09-11 15:56       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-11 16:10         ` Sascha Hauer
2012-09-11 17:24           ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-12  6:47             ` Sascha Hauer
2012-09-11 13:31 ` [PATCH 4/5] driver: rewrite dev_printf as a function Sascha Hauer
2012-09-11 13:31 ` [PATCH 5/5] driver: Add platform_device_id mechanism Sascha Hauer

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=1347370313-15184-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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