Re: [PATCH v1 1/2] spi: deduplicate spi_match_id() in __spi_register_driver()

From: Andy Shevchenko
Date: Tue Nov 23 2021 - 10:43:29 EST


On Tue, Nov 23, 2021 at 03:22:38PM +0000, Jon Hunter wrote:
> On 19/11/2021 17:37, Andy Shevchenko wrote:

> > @@ -474,12 +473,8 @@ int __spi_register_driver(struct module *owner, struct spi_driver *sdrv)
> > if (sdrv->id_table) {
> > const struct spi_device_id *spi_id;
> > - for (spi_id = sdrv->id_table; spi_id->name[0];
> > - spi_id++)
> > - if (strcmp(spi_id->name, of_name) == 0)
> > - break;

> > - if (spi_id->name[0])
> > + spi_id = spi_match_id(sdrv->id_table, of_name);
> > + if (!spi_id)

Seems I have inverted condition here. Shouldn't it be

if (spi_id)

instead?

> > continue;
> > } else {
> > if (strcmp(sdrv->driver.name, of_name) == 0)
> >
>
>
> Following this change I am seeing the following warnings again although most
> of these have now been fixed ...
>
> WARNING KERN SPI driver mtd_dataflash has no spi_device_id for atmel,at45
> WARNING KERN SPI driver mtd_dataflash has no spi_device_id for
> atmel,dataflash
> WARNING KERN SPI driver spi-nor has no spi_device_id for jedec,spi-nor
> WARNING KERN SPI driver mmc_spi has no spi_device_id for mmc-spi-slot
> WARNING KERN SPI driver cros-ec-spi has no spi_device_id for
> google,cros-ec-spi
>
> I have not looked any further yet, but this appears to cause the SPI ID
> match to fail.

Ah, thanks for testing!
Can you try above?

--
With Best Regards,
Andy Shevchenko