]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: adc: ad7476: Simplify chip type detection
authorMatti Vaittinen <mazziesaccount@gmail.com>
Mon, 11 Aug 2025 08:50:27 +0000 (11:50 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 16 Aug 2025 12:21:20 +0000 (13:21 +0100)
commit79ca9bf90c8ac9f4f3560aa50dcf37d59d218c76
tree8424d0899b0dd62f5dde38c56a68654d9f6d6042
parentc1d7b8fe67e6b05a4a521d00ddc015811cb29b61
iio: adc: ad7476: Simplify chip type detection

The ad7476 driver uses a table of structures for defining the IC variant
specific data. Table is indexed using enum values, which are picked by
SPI ID.

Having the table and an enum adds extra complexity and may encourage
adding IC specific quircks in the code, instead of centralizing the IC
differences in one place, the chip-info.

Simplify this by dropping the table and using individual structures for
the IC specific data, and storing the IC specific structure's address
directly in the SPI ID data. Finally, switch to the
spi_get_device_match_data() and add a check for the return value.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/9e179bb3ba52303448ae4a559c1f011acd3f2fa6.1754901948.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7476.c