On Thu, Aug 11, 2016 at 01:13:27AM +0000, First Light wrote: > > On Wed, Aug 10, 2016 at 08:50:08AM +0000, First Light wrote: Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to. > > That shouldn't happen, if it does it's a bug - users should never see a negative > > bus number, the core should dynamically assign one if it is given a negative bus > > number. Can you check what happens in spi_register_master()? That's > > where the dynamic bus number should be being assigned. > [First Light] I'm using linux-4.4 kernel, and In spi-dw-mmio.c, > I see that: > LINE74: dws->bus_num = pdev-->id; (dws is struct dw_spi, not struct spi_master) > LINE107: ret=dw_spi_add_host(&pdev->dev, dws); > spi_register_master is called in dw_spi_add_host. > So dws->bus_num is not dynamically assigned, but just one static value since pdev->id is not inited. This doesn't matter so long as the default value passed into spi_register_master() is negative. > I think you are saying spi_master->bus_num is dynamically inited. Right? Yes, but by spi_register_master(). > I also see that spi_master->bus_num is inited with dws->bus_number first, and the it finds that this bus_num < 0, > then uses of_alias_get_id or atomic_dec_return(&dyn_bus_id) to get a dynamic one. > Question is: do we need to update dws->bus_num again? It is -1 always. No, just pass that into the core and the core should take care of things. > unlike other devices, like i2c0, i2c1,..., spi's device name is dw_spi65535, > both of the spi devices I registered have this name. 65535 is -1. > There must be something unmatched. Please trace through the code and try to see where this is happening, this doesn't seem to be affecting other users.
Attachment:
signature.asc
Description: PGP signature