Skip to content

Commit f09f6df

Browse files
Russ Weightbroonie
authored andcommitted
spi: altera: Change to dynamic allocation of spi id
The spi-altera driver has two flavors: platform and dfl. I'm seeing a case where I have both device types in the same machine, and they are conflicting on the SPI ID: ... kernel: couldn't get idr ... kernel: WARNING: CPU: 28 PID: 912 at drivers/spi/spi.c:2920 spi_register_controller.cold+0x84/0xc0a Both the platform and dfl drivers use the parent's driver ID as the SPI ID. In the error case, the parent devices are dfl_dev.4 and subdev_spi_altera.4.auto. When the second spi-master is created, the failure occurs because the SPI ID of 4 has already been allocated. Change the ID allocation to dynamic (by initializing bus_num to -1) to avoid duplicate SPI IDs. Signed-off-by: Russ Weight <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 16a8e2f commit f09f6df

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/spi/spi-altera-dfl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)
134134
if (!master)
135135
return -ENOMEM;
136136

137-
master->bus_num = dfl_dev->id;
137+
master->bus_num = -1;
138138

139139
hw = spi_master_get_devdata(master);
140140

drivers/spi/spi-altera-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static int altera_spi_probe(struct platform_device *pdev)
4848
return err;
4949

5050
/* setup the master state. */
51-
master->bus_num = pdev->id;
51+
master->bus_num = -1;
5252

5353
if (pdata) {
5454
if (pdata->num_chipselect > ALTERA_SPI_MAX_CS) {

0 commit comments

Comments
 (0)