diff mbox

spi: xilinx: Use pdev->id instead of pdev->dev.id for the SPI bus number

Message ID 1404981020-22640-1-git-send-email-lars@metafoo.de (mailing list archive)
State Accepted
Commit 4b153a2137c5d2914794c8944d78c731c1b0ae9d
Headers show

Commit Message

Lars-Peter Clausen July 10, 2014, 8:30 a.m. UTC
The Xilinx SPI driver initializes the bus_num field of the SPI master to
pdev->dev.id. pdev->dev.id is always 0 for platform devices which causes bus
number conflicts for the SPI controller when creating multiple device instances
of the driver. Instead use pdev->id which will have the assignt platform device
id. If the device is instantiated via devicetree pdev->id is -1 which will cause
the SPI core to dynamically assign a id (or use the id defined via a alias in
the devicetree).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/spi/spi-xilinx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown July 10, 2014, 10:39 a.m. UTC | #1
On Thu, Jul 10, 2014 at 10:30:20AM +0200, Lars-Peter Clausen wrote:
> The Xilinx SPI driver initializes the bus_num field of the SPI master to
> pdev->dev.id. pdev->dev.id is always 0 for platform devices which causes bus
> number conflicts for the SPI controller when creating multiple device instances

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index a3b0b99..4d8efb1 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -369,7 +369,7 @@  static int xilinx_spi_probe(struct platform_device *pdev)
 		goto put_master;
 	}
 
-	master->bus_num = pdev->dev.id;
+	master->bus_num = pdev->id;
 	master->num_chipselect = num_cs;
 	master->dev.of_node = pdev->dev.of_node;