mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Cc: jbe@pengutronix.de
Subject: [PATCH 1/7] spi: Call spi_of_register_slaves from core
Date: Mon, 28 Oct 2013 13:01:34 +0100	[thread overview]
Message-ID: <1382961700-8833-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1382961700-8833-1-git-send-email-s.hauer@pengutronix.de>

Makes individual handling of OF spi slaves unnecessary in the bus drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/spi/imx_spi.c   | 2 --
 drivers/spi/mvebu_spi.c | 3 ---
 drivers/spi/spi.c       | 8 +++++++-
 include/spi/spi.h       | 2 --
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 6f942bf..1c6b684 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -517,8 +517,6 @@ static int imx_spi_dt_probe(struct imx_spi *imx)
 		imx->cs_array[i] = cs_gpio;
 	}
 
-	spi_of_register_slaves(&imx->master, node);
-
 	return 0;
 }
 
diff --git a/drivers/spi/mvebu_spi.c b/drivers/spi/mvebu_spi.c
index 7aaa9fe..4a6d96f 100644
--- a/drivers/spi/mvebu_spi.c
+++ b/drivers/spi/mvebu_spi.c
@@ -361,9 +361,6 @@ static int mvebu_spi_probe(struct device_d *dev)
 	master->transfer = mvebu_spi_transfer;
 	master->num_chipselect = 1;
 
-	if (dev->device_node)
-		spi_of_register_slaves(master, dev->device_node);
-
 	ret = spi_register_master(master);
 	if (!ret)
 		return 0;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 55bebe0..d273050 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -101,11 +101,15 @@ fail:
 EXPORT_SYMBOL(spi_new_device);
 
 #ifdef CONFIG_OFDEVICE
-void spi_of_register_slaves(struct spi_master *master, struct device_node *node)
+static void spi_of_register_slaves(struct spi_master *master)
 {
 	struct device_node *n;
 	struct spi_board_info chip;
 	struct property *reg;
+	struct device_node *node = master->dev->device_node;
+
+	if (!node)
+		return;
 
 	for_each_child_of_node(node, n) {
 		memset(&chip, 0, sizeof(chip));
@@ -222,6 +226,8 @@ int spi_register_master(struct spi_master *master)
 
 	list_add_tail(&master->list, &spi_master_list);
 
+	spi_of_register_slaves(master);
+
 	/* populate children from any spi device tables */
 	scan_boardinfo(master);
 	status = 0;
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 45fd22c..b4358a8 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -446,6 +446,4 @@ static inline int spi_driver_register(struct driver_d *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.8.4.rc3


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

  reply	other threads:[~2013-10-28 12:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 12:01 spi/mtd/m25p80 patches Sascha Hauer
2013-10-28 12:01 ` Sascha Hauer [this message]
2013-10-28 12:01 ` [PATCH 2/7] spi: support dynamic bus ids Sascha Hauer
2013-10-28 12:01 ` [PATCH 3/7] spi: Get bus_num from devicetree Sascha Hauer
2013-10-28 12:01 ` [PATCH 4/7] ARM: i.MX6: Add spi aliases to devicetree Sascha Hauer
2013-10-28 12:01 ` [PATCH 5/7] mtd: raw: rename raw device Sascha Hauer
2013-10-28 12:01 ` [PATCH 6/7] mtd: Pass device_id to add_mtd_device Sascha Hauer
2013-10-28 12:01 ` [PATCH 7/7] mtd: m25p80: Allow to specify devicename via devicetree alias 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=1382961700-8833-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=jbe@pengutronix.de \
    /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