summaryrefslogtreecommitdiff
path: root/drivers/iio/magnetometer
diff options
context:
space:
mode:
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>2026-06-19 17:54:39 +0200
committerJonathan Cameron <jic23@kernel.org>2026-06-30 00:15:56 +0100
commit0a20c840d69b9489535099db541b744a678e0784 (patch)
treee709491ce6d900fffc0b1762b10ec6697c220204 /drivers/iio/magnetometer
parentd7ed041207a7aa243e4f68e892d80e0d660d22b2 (diff)
downloadlinux-next-0a20c840d69b9489535099db541b744a678e0784.tar.gz
linux-next-0a20c840d69b9489535099db541b744a678e0784.zip
iio: Initialize spi_device_id arrays using member names
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. The mentioned robustness is relevant for a planned change to struct spi_device_id that replaces .driver_data by an anonymous union. This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Acked-by: Linus Walleij <linusw@kernel.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer')
-rw-r--r--drivers/iio/magnetometer/st_magn_spi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
index 68816362bb95..9697edabf879 100644
--- a/drivers/iio/magnetometer/st_magn_spi.c
+++ b/drivers/iio/magnetometer/st_magn_spi.c
@@ -88,12 +88,12 @@ static int st_magn_spi_probe(struct spi_device *spi)
}
static const struct spi_device_id st_magn_id_table[] = {
- { LIS3MDL_MAGN_DEV_NAME },
- { LSM303AGR_MAGN_DEV_NAME },
- { LIS2MDL_MAGN_DEV_NAME },
- { LSM9DS1_MAGN_DEV_NAME },
- { IIS2MDC_MAGN_DEV_NAME },
- { LSM303C_MAGN_DEV_NAME },
+ { .name = LIS3MDL_MAGN_DEV_NAME },
+ { .name = LSM303AGR_MAGN_DEV_NAME },
+ { .name = LIS2MDL_MAGN_DEV_NAME },
+ { .name = LSM9DS1_MAGN_DEV_NAME },
+ { .name = IIS2MDC_MAGN_DEV_NAME },
+ { .name = LSM303C_MAGN_DEV_NAME },
{ }
};
MODULE_DEVICE_TABLE(spi, st_magn_id_table);