staging: 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>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/cac7a68e6a6adb1b58207640ab045e59eec86f53.1781883685.git.u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Uwe Kleine-König (The Capable Hub) 2026-06-30 17:35:36 +02:00 committed by Jonathan Cameron
parent b15df8dab7
commit 0846f13ef4
2 changed files with 7 additions and 7 deletions

View File

@ -426,9 +426,9 @@ static const struct of_device_id ad7816_of_match[] = {
MODULE_DEVICE_TABLE(of, ad7816_of_match);
static const struct spi_device_id ad7816_id[] = {
{ "ad7816", ID_AD7816 },
{ "ad7817", ID_AD7817 },
{ "ad7818", ID_AD7818 },
{ .name = "ad7816", .driver_data = ID_AD7816 },
{ .name = "ad7817", .driver_data = ID_AD7817 },
{ .name = "ad7818", .driver_data = ID_AD7818 },
{ }
};

View File

@ -465,10 +465,10 @@ static int ad9834_probe(struct spi_device *spi)
}
static const struct spi_device_id ad9834_id[] = {
{"ad9833", ID_AD9833},
{"ad9834", ID_AD9834},
{"ad9837", ID_AD9837},
{"ad9838", ID_AD9838},
{ .name = "ad9833", .driver_data = ID_AD9833 },
{ .name = "ad9834", .driver_data = ID_AD9834 },
{ .name = "ad9837", .driver_data = ID_AD9837 },
{ .name = "ad9838", .driver_data = ID_AD9838 },
{ }
};
MODULE_DEVICE_TABLE(spi, ad9834_id);