]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: adc: adc128s052: Simplify matching chip_data
authorMatti Vaittinen <mazziesaccount@gmail.com>
Mon, 18 Aug 2025 08:12:39 +0000 (11:12 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 18 Aug 2025 19:12:08 +0000 (20:12 +0100)
commit7fe5b83fbcefb100c4fcec034a4a55507cd493e2
tree7024ce24e481736c10b0731cb2804c5914106357
parentf1bbfc405e3d36545f4fd1931c3e1d32396d1b63
iio: adc: adc128s052: Simplify matching chip_data

The adc128s052 driver supports a few different ICs. IC specific
configuration data is stored in an array. IC data, residing in a
specific point of the array, is pointed from the SPI device match data.

There is no need to have the chip config data structures in an array
and splitting them out of an array has at least following benefits:

- Chip-specific structures can be named after the chips they support.
  This makes referring them a tad cleaner, compared to using a generic
  array name with a numerical index.

- Avoid all potential 'out of bounds' errors which can result if the
  array is changed.

Split the chip configuration data array to individual structures.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/943b6f4852ff0944eeaa0366cbe3b5aaf440cf23.1755504346.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-adc128s052.c