Re: [PATCH 2/3] iio: adc: adc128s052: Simplify matching chip_data

From: David Lechner
Date: Thu Aug 14 2025 - 11:01:43 EST


On 8/14/25 3:35 AM, Matti Vaittinen wrote:
> 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@xxxxxxxxx>
>
> ---
Reviewed-by: David Lechner <dlechner@xxxxxxxxxxxx>