aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2010-07-27 22:35:58 +0200
committerGrant Likely <grant.likely@secretlab.ca>2010-07-30 00:03:59 -0600
commit12b15e83289bc7cf2ec9a342412e0c955beeb395 (patch)
treeda1560511f56a9c63246be0ff449229c7adf36b1 /drivers/of
parentof: Provide default of_node_to_nid() implementation. (diff)
downloadlinux-dev-12b15e83289bc7cf2ec9a342412e0c955beeb395.tar.xz
linux-dev-12b15e83289bc7cf2ec9a342412e0c955beeb395.zip
of/spi: call of_register_spi_devices() from spi core code
Move of_register_spi_devices() call from drivers to spi_register_master(). Also change the function to use the struct device_node pointer from master spi device instead of passing it as function argument. Signed-off-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/of_spi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
index d504f1d1324b..1dbce58a58b0 100644
--- a/drivers/of/of_spi.c
+++ b/drivers/of/of_spi.c
@@ -15,12 +15,11 @@
/**
* of_register_spi_devices - Register child devices onto the SPI bus
* @master: Pointer to spi_master device
- * @np: parent node of SPI device nodes
*
- * Registers an spi_device for each child node of 'np' which has a 'reg'
+ * Registers an spi_device for each child node of master node which has a 'reg'
* property.
*/
-void of_register_spi_devices(struct spi_master *master, struct device_node *np)
+void of_register_spi_devices(struct spi_master *master)
{
struct spi_device *spi;
struct device_node *nc;
@@ -28,7 +27,10 @@ void of_register_spi_devices(struct spi_master *master, struct device_node *np)
int rc;
int len;
- for_each_child_of_node(np, nc) {
+ if (!master->dev.of_node)
+ return;
+
+ for_each_child_of_node(master->dev.of_node, nc) {
/* Alloc an spi_device */
spi = spi_alloc_device(master);
if (!spi) {