Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: ad9467: Silence no spi_device_id warnings

SPI devices use the spi_device_id for module autoloading even on
systems using device tree, after commit 5fa6863ba692 ("spi: Check
we have a spi_device_id for each DT compatible"), kernel warns as
follows since the spi_device_id is missing:

SPI driver ad9467 has no spi_device_id for adi,ad9265
SPI driver ad9467 has no spi_device_id for adi,ad9434

Add spi_device_id entries to silence the warnings, and ensure driver
module autoloading works.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220921163620.805879-4-weiyongjun@huaweicloud.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Wei Yongjun and committed by
Jonathan Cameron
28302652 35dab731

+11
+11
drivers/iio/adc/ad9467.c
··· 388 388 389 389 info = of_device_get_match_data(&spi->dev); 390 390 if (!info) 391 + info = (void *)spi_get_device_id(spi)->driver_data; 392 + if (!info) 391 393 return -ENODEV; 392 394 393 395 conv = devm_adi_axi_adc_conv_register(&spi->dev, sizeof(*st)); ··· 449 447 }; 450 448 MODULE_DEVICE_TABLE(of, ad9467_of_match); 451 449 450 + static const struct spi_device_id ad9467_ids[] = { 451 + { "ad9265", (kernel_ulong_t)&ad9467_chip_tbl[ID_AD9265] }, 452 + { "ad9434", (kernel_ulong_t)&ad9467_chip_tbl[ID_AD9434] }, 453 + { "ad9467", (kernel_ulong_t)&ad9467_chip_tbl[ID_AD9467] }, 454 + {} 455 + }; 456 + MODULE_DEVICE_TABLE(spi, ad9467_ids); 457 + 452 458 static struct spi_driver ad9467_driver = { 453 459 .driver = { 454 460 .name = "ad9467", 455 461 .of_match_table = ad9467_of_match, 456 462 }, 457 463 .probe = ad9467_probe, 464 + .id_table = ad9467_ids, 458 465 }; 459 466 module_spi_driver(ad9467_driver); 460 467