]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tty: serial: Use named initializers for arrays of i2c_device_data
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Mon, 18 May 2026 10:14:56 +0000 (12:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 May 2026 09:46:29 +0000 (11:46 +0200)
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
i2c_device_id that replaces .driver_data by an anonymous union.

While touching all these arrays, unify usage of whitespace in the list
terminator.

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>
Link: https://patch.msgid.link/20260518101456.632410-2-u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/max310x.c
drivers/tty/serial/sc16is7xx_i2c.c

index bad5329a0c84c2870d46d38c976a5e213c4b0a1f..e28e3065c99d3fa9d0520679a1fed8e8ebadb271 100644 (file)
@@ -1699,10 +1699,10 @@ static void max310x_i2c_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id max310x_i2c_id_table[] = {
-       { "max3107",    (kernel_ulong_t)&max3107_devtype, },
-       { "max3108",    (kernel_ulong_t)&max3108_devtype, },
-       { "max3109",    (kernel_ulong_t)&max3109_devtype, },
-       { "max14830",   (kernel_ulong_t)&max14830_devtype, },
+       { .name = "max3107", .driver_data = (kernel_ulong_t)&max3107_devtype },
+       { .name = "max3108", .driver_data = (kernel_ulong_t)&max3108_devtype },
+       { .name = "max3109", .driver_data = (kernel_ulong_t)&max3109_devtype },
+       { .name = "max14830", .driver_data = (kernel_ulong_t)&max14830_devtype },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, max310x_i2c_id_table);
index 699376c3b3a54c733cfeb8eb37225df1aa8a0b5e..6c2a697556a61e060b0a349303e5e7df2107f11d 100644 (file)
@@ -39,13 +39,13 @@ static void sc16is7xx_i2c_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id sc16is7xx_i2c_id_table[] = {
-       { "sc16is74x",  (kernel_ulong_t)&sc16is74x_devtype, },
-       { "sc16is740",  (kernel_ulong_t)&sc16is74x_devtype, },
-       { "sc16is741",  (kernel_ulong_t)&sc16is74x_devtype, },
-       { "sc16is750",  (kernel_ulong_t)&sc16is750_devtype, },
-       { "sc16is752",  (kernel_ulong_t)&sc16is752_devtype, },
-       { "sc16is760",  (kernel_ulong_t)&sc16is760_devtype, },
-       { "sc16is762",  (kernel_ulong_t)&sc16is762_devtype, },
+       { .name = "sc16is74x", .driver_data = (kernel_ulong_t)&sc16is74x_devtype },
+       { .name = "sc16is740", .driver_data = (kernel_ulong_t)&sc16is74x_devtype },
+       { .name = "sc16is741", .driver_data = (kernel_ulong_t)&sc16is74x_devtype },
+       { .name = "sc16is750", .driver_data = (kernel_ulong_t)&sc16is750_devtype },
+       { .name = "sc16is752", .driver_data = (kernel_ulong_t)&sc16is752_devtype },
+       { .name = "sc16is760", .driver_data = (kernel_ulong_t)&sc16is760_devtype },
+       { .name = "sc16is762", .driver_data = (kernel_ulong_t)&sc16is762_devtype },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, sc16is7xx_i2c_id_table);