]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/chrome: Use named initializers for struct i2c_device_id
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Tue, 19 May 2026 15:08:18 +0000 (17:08 +0200)
committerTzung-Bi Shih <tzungbi@kernel.org>
Wed, 20 May 2026 04:18:38 +0000 (04:18 +0000)
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>
Link: https://lore.kernel.org/r/20260519150819.1591409-2-u.kleine-koenig@baylibre.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_i2c.c
drivers/platform/chrome/cros_hps_i2c.c

index def1144a077ea633324c65d59c9bf03c034f6403..2f46be4a2756971223cc37c3a9b1a2e810deb4a0 100644 (file)
@@ -348,7 +348,7 @@ MODULE_DEVICE_TABLE(of, cros_ec_i2c_of_match);
 #endif
 
 static const struct i2c_device_id cros_ec_i2c_id[] = {
-       { "cros-ec-i2c" },
+       { .name = "cros-ec-i2c" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, cros_ec_i2c_id);
index ac6498c593e3fe92f63f217b1611d55c53700685..3b9485627831299e4ad720f4c322376bfb395114 100644 (file)
@@ -131,7 +131,7 @@ static int hps_resume(struct device *dev)
 static DEFINE_RUNTIME_DEV_PM_OPS(hps_pm_ops, hps_suspend, hps_resume, NULL);
 
 static const struct i2c_device_id hps_i2c_id[] = {
-       { "cros-hps" },
+       { .name = "cros-hps" },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, hps_i2c_id);