On Tue, Nov 17, 2020 at 1:01 PM Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> wrote: > > On Tue, 17 Nov 2020 09:52:53 +0200 > Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> wrote: > > > This change removes the SPI device table, adds an OF device table instead. > > This should also be usable for ACPI via PRP0001. > > > > This device is usually probed via device-tree, so it makes more sense to > > use the OF device table. > > > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx> > So, we've had a few cases of having to put the device_id table > back again recently. > https://lore.kernel.org/linux-iio/20201101152613.2c37581a@archlinux/ > > They tend to be due to greybus doing it's probing in yet another fashion. > So far they've been all i2c devices, but I kind of assume it does the same for spi. > https://elixir.bootlin.com/linux/latest/source/drivers/staging/greybus/spilib.c#L437 > > How device_get_match_data() plays with that I'm not sure. It probably > doesn't right now given swnode doesn't have a device_get_match_data() callback. > > https://elixir.bootlin.com/linux/latest/source/drivers/base/swnode.c#L539 > > So after all that I think I've argued myself around to thinking what you have > here is fine. If someone wants to support this via a swnode then they can > figure out how to make that work. > > +CC Vaishnav and Andy for their input. device_get_match_data() doesn't know about bus type specifics. One may introduce a helper like const void *spi_device_get_match_data(dev) { const void *match = device_get_match_data(dev); if (match) return match; return spi_dev_id....; } And use it with the SPI ID table. -- With Best Regards, Andy Shevchenko