]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: iio: Use named initializers for struct i2c_device_id
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Tue, 19 May 2026 14:06:20 +0000 (16:06 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 10:01:46 +0000 (11:01 +0100)
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.

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: Stepan Ionichev <sozdayvek@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/addac/adt7316-i2c.c
drivers/staging/iio/impedance-analyzer/ad5933.c

index 3bdaee925deeeb4fe5b573ab9b9bbbbc892e2bd4..98f2e23c6a4bbd9d8fb960bedc4e5f0c85f66836 100644 (file)
@@ -109,12 +109,12 @@ static int adt7316_i2c_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id adt7316_i2c_id[] = {
-       { "adt7316" },
-       { "adt7317" },
-       { "adt7318" },
-       { "adt7516" },
-       { "adt7517" },
-       { "adt7519" },
+       { .name = "adt7316" },
+       { .name = "adt7317" },
+       { .name = "adt7318" },
+       { .name = "adt7516" },
+       { .name = "adt7517" },
+       { .name = "adt7519" },
        { }
 };
 
index dde2ec9d1f6a9c3f8e885917a80e0930ef8c0d20..798e62bae29b0ec4d284ffa51560098c2abedbda 100644 (file)
@@ -726,8 +726,8 @@ static int ad5933_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id ad5933_id[] = {
-       { "ad5933" },
-       { "ad5934" },
+       { .name = "ad5933" },
+       { .name = "ad5934" },
        { }
 };