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

iio: adc: ad7124: 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 ad7124 has no spi_device_id for adi,ad7124-4
SPI driver ad7124 has no spi_device_id for adi,ad7124-8

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-6-weiyongjun@huaweicloud.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Wei Yongjun and committed by
Jonathan Cameron
3a258747 935779ea

+10
+10
drivers/iio/adc/ad7124.c
··· 945 945 946 946 info = of_device_get_match_data(&spi->dev); 947 947 if (!info) 948 + info = (void *)spi_get_device_id(spi)->driver_data; 949 + if (!info) 948 950 return -ENODEV; 949 951 950 952 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ··· 1023 1021 }; 1024 1022 MODULE_DEVICE_TABLE(of, ad7124_of_match); 1025 1023 1024 + static const struct spi_device_id ad71124_ids[] = { 1025 + { "ad7124-4", (kernel_ulong_t)&ad7124_chip_info_tbl[ID_AD7124_4] }, 1026 + { "ad7124-8", (kernel_ulong_t)&ad7124_chip_info_tbl[ID_AD7124_8] }, 1027 + {} 1028 + }; 1029 + MODULE_DEVICE_TABLE(spi, ad71124_ids); 1030 + 1026 1031 static struct spi_driver ad71124_driver = { 1027 1032 .driver = { 1028 1033 .name = "ad7124", 1029 1034 .of_match_table = ad7124_of_match, 1030 1035 }, 1031 1036 .probe = ad7124_probe, 1037 + .id_table = ad71124_ids, 1032 1038 }; 1033 1039 module_spi_driver(ad71124_driver); 1034 1040