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

iio: adc: ad7192: 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 ad7192 has no spi_device_id for adi,ad7190
SPI driver ad7192 has no spi_device_id for adi,ad7193
SPI driver ad7192 has no spi_device_id for adi,ad7195

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

authored by

Wei Yongjun and committed by
Jonathan Cameron
935779ea 28302652

+12
+12
drivers/iio/adc/ad7192.c
··· 1037 1037 st->int_vref_mv = ret / 1000; 1038 1038 1039 1039 st->chip_info = of_device_get_match_data(&spi->dev); 1040 + if (!st->chip_info) 1041 + st->chip_info = (void *)spi_get_device_id(spi)->driver_data; 1040 1042 indio_dev->name = st->chip_info->name; 1041 1043 indio_dev->modes = INDIO_DIRECT_MODE; 1042 1044 ··· 1100 1098 }; 1101 1099 MODULE_DEVICE_TABLE(of, ad7192_of_match); 1102 1100 1101 + static const struct spi_device_id ad7192_ids[] = { 1102 + { "ad7190", (kernel_ulong_t)&ad7192_chip_info_tbl[ID_AD7190] }, 1103 + { "ad7192", (kernel_ulong_t)&ad7192_chip_info_tbl[ID_AD7192] }, 1104 + { "ad7193", (kernel_ulong_t)&ad7192_chip_info_tbl[ID_AD7193] }, 1105 + { "ad7195", (kernel_ulong_t)&ad7192_chip_info_tbl[ID_AD7195] }, 1106 + {} 1107 + }; 1108 + MODULE_DEVICE_TABLE(spi, ad7192_ids); 1109 + 1103 1110 static struct spi_driver ad7192_driver = { 1104 1111 .driver = { 1105 1112 .name = "ad7192", 1106 1113 .of_match_table = ad7192_of_match, 1107 1114 }, 1108 1115 .probe = ad7192_probe, 1116 + .id_table = ad7192_ids, 1109 1117 }; 1110 1118 module_spi_driver(ad7192_driver); 1111 1119