2018-08-15 14:31:08

by Kirill Kapranov

[permalink] [raw]
Subject: Re2: [PATCH] spi:fix IDR collision on systems with both fixed and dynamic SPI bus numbers

On 08/14/2018 05:18 PM, Mark Brown wrote:
> Is this something that's actually happened for you?

Yes, I observed it.

Background:
The platform: fitlet2 [1] , CPU Intel(R) Celeron(R) CPU J3455 @ 1.50GHz.
On an extension board there are three SPI master controllers "Intel
Corporation Atom/Celeron/Pentium Processor N4200/N3350/E3900 Series SPI
Controller", controlled with spi_pxa2xx_platform driver,
and two USB/SPI bridges "FT232H Single HS USB-UART/FIFO IC".

I'm working on a driver for FT232H bridge and saw the following:
spi_pxa2xx driver occupy IDs 1,2,3 this way [2].
Thus when my code tries to get ID automatically (set spi_master.bus_num=
-1), it gets IDs 0 and 1, that leads a crash.

BTW, I haven't the faintest idea, how to cure this problem in the
opposite case: when a device that gets ID dynamically squats an ID
purposed for a device that uses a fixed numbering order.

>> + } else {
>> + /* devices with a fixed bus num must check-in with the num */
>> + mutex_lock(&board_lock);
> The indentation here is weird, the comment isn't aligned with the code
> it's commenting on.
I'm sorry for the oversight, it'll be fixed.

[1] https://fit-iot.com/web/products/fitlet2/
[2]
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi-pxa2xx.c#L1361



2018-08-15 14:38:42

by Mark Brown

[permalink] [raw]
Subject: Re: Re2: [PATCH] spi:fix IDR collision on systems with both fixed and dynamic SPI bus numbers

On Wed, Aug 15, 2018 at 05:28:56PM +0300, Kirill Kapranov wrote:
> On 08/14/2018 05:18 PM, Mark Brown wrote:
> > Is this something that's actually happened for you?

> Yes, I observed it.

OK, that's useful to know - it differentiates between a nice to have fix
and something that should be sent to Linus and/or stable.


Attachments:
(No filename) (328.00 B)
signature.asc (499.00 B)
Download all attachments