spi: altera: Change to dynamic allocation of spi id
PATCH 1/1 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.
--- drivers/spi/spi-altera-dfl.c | 2 +- drivers/spi/spi-altera-platform.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-altera-dfl.c +1 -1
@@ -134,7 +134,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)if (!master)return -ENOMEM ; - master->bus_num = dfl_dev->id; + master->bus_num =-1 ; hw =spi_master_get_devdata (master);
drivers/spi/spi-altera-platform.c +1 -1
@@ -48,7 +48,7 @@ static int altera_spi_probe(struct platform_device *pdev)return err;/* setup the master state. */ - master->bus_num = pdev->id; + master->bus_num =-1 ;if (pdata) {if (pdata->num_chipselect >ALTERA_SPI_MAX_CS ) {
Signature · 1 line
2.25.1
If there are no concerns with this patch, it will need to have the "cc stable" tag added for earlier kernels.
I don't think it needs a "Fixes" tag, as the problem has been there since the driver was introduced.
Thanks,
- Russ
Quoted 47 lines · Russ Weight
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 atdrivers/spi/spi.c:2920spi_register_controller.cold+0x84/0xc0aBoth 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_numto -1) to avoid duplicate SPI IDs.Signed-off-by Russ Weight <[email protected]>--- drivers/spi/spi-altera-dfl.c | 2 +- drivers/spi/spi-altera-platform.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/spi/spi-altera-dfl.c +1
-1@@ -134,7 +134,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)if (!master)return -ENOMEM ; - master->bus_num = dfl_dev->id; + master->bus_num =-1 ; hw =spi_master_get_devdata (master);drivers/spi/spi-altera-platform.c +1
-1@@ -48,7 +48,7 @@ static int altera_spi_probe(struct platform_device *pdev)return err;/* setup the master state. */ - master->bus_num = pdev->id; + master->bus_num =-1 ;if (pdata) {if (pdata->num_chipselect >ALTERA_SPI_MAX_CS ) {
Mark Brown
maintainerQuoted 2 lines · Russ Weight
If there are no concerns with this patch, it will need to have the "cc stable" tag added for earlier kernels.
This feels like a risky change to introduce into stable kernels given that while people shouldn't rely on stable number assignment they may well have done so. I'll skip the stable tag though if you want to request a backport with the stable team they might be OK with it - it definitely feels like it should have a discussion rather than just going in with a tag.
Quoted 11 lines · Mark Brown
Quoted 2 lines · Russ Weight
If there are no concerns with this patch, it will need to have the "cc stable" tag added for earlier kernels.
This feels like a risky change to introduce into stable kernels given that while people shouldn't rely on stable number assignment they may well have done so. I'll skip the stable tag though if you want to request a backport with the stable team they might be OK with it - it definitely feels like it should have a discussion rather than just going in with a tag.
It makes sense. Just skip my stable tag comment.
Thanks,
Yilun
Xu Yilun
Acked-byQuoted 2 lines · Russ Weight
If there are no concerns with this patch, it will need to have the "cc stable" tag added for earlier kernels.
The code is good to me, and please add the cc stable tag.
Quoted 3 lines
I don't think it needs a "Fixes" tag, as the problem has been there since the driver was introduced.
You could add the Fixes tag for the patches that introduce the drivers.
Quoted 21 lines
Thanks,
- RussQuoted 16 lines · Russ Weight
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 atdrivers/spi/spi.c:2920spi_register_controller.cold+0x84/0xc0aBoth 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_numto -1) to avoid duplicate SPI IDs.Signed-off-by Russ Weight <[email protected]>
Please add the tags and then,
Thanks,
Yilun
Quoted 31 lines
Quoted 31 lines
--- drivers/spi/spi-altera-dfl.c | 2 +- drivers/spi/spi-altera-platform.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/spi/spi-altera-dfl.c +1
-1@@ -134,7 +134,7 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_dev)if (!master)return -ENOMEM ; - master->bus_num = dfl_dev->id; + master->bus_num =-1 ; hw =spi_master_get_devdata (master);drivers/spi/spi-altera-platform.c +1
-1@@ -48,7 +48,7 @@ static int altera_spi_probe(struct platform_device *pdev)return err;/* setup the master state. */ - master->bus_num = pdev->id; + master->bus_num =-1 ;if (pdata) {if (pdata->num_chipselect >ALTERA_SPI_MAX_CS ) {
Quoted 8 lines · Russ Weight
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 atdrivers/spi/spi.c:2920spi_register_controller.cold+0x84/0xc0a[...]
Applied, thanks!
[1/1] spi: altera: Change to dynamic allocation of spi id
commit: f09f6dfef8ce7b70a240cf83811e2b1909c3e47b
Best regards,
Signature · 1 line
Mark Brown,,, <[email protected]>
Mark Brown
maintainerQuoted 8 lines · Russ Weight
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 atdrivers/spi/spi.c:2920spi_register_controller.cold+0x84/0xc0a[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: altera: Change to dynamic allocation of spi id
commit: f09f6dfef8ce7b70a240cf83811e2b1909c3e47b
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark