From 2fa5f069585d6755ff27321345d8c0940a4b88e2 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Oct 2013 12:10:36 +0100 Subject: spi: Get bus_num from devicetree Get the bus_num from devicetree if a "spi" alias exists. Signed-off-by: Sascha Hauer --- drivers/spi/spi.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/spi/spi.c') diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 64aa63e47a..ad65884fda 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -226,6 +226,9 @@ int spi_register_master(struct spi_master *master) if (master->num_chipselect == 0) return -EINVAL; + if ((master->bus_num < 0) && master->dev->device_node) + master->bus_num = of_alias_get_id(master->dev->device_node, "spi"); + /* convention: dynamically assigned bus IDs count down from the max */ if (master->bus_num < 0) master->bus_num = dyn_bus_id--; -- cgit v1.2.3