]> git.karo-electronics.de Git - linux-beck.git/commitdiff
spi: xilinx: Use pdev->id instead of pdev->dev.id for the SPI bus number
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 10 Jul 2014 08:30:20 +0000 (10:30 +0200)
committerMark Brown <broonie@linaro.org>
Thu, 10 Jul 2014 10:38:45 +0000 (12:38 +0200)
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>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-xilinx.c

index a3b0b9944bf000c7b69afd868a1c8eed71308489..4d8efb16573d1a7c8690fee0464a0b34734030c4 100644 (file)
@@ -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;