[PATCH v1 2/2] extcon: Use named initializers for arrays of i2c_device_data

From: Uwe Kleine-König (The Capable Hub)

Date: Mon May 18 2026 - 06:43:04 EST


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@xxxxxxxxxxxx>
---
drivers/extcon/extcon-fsa9480.c | 4 ++--
drivers/extcon/extcon-lc824206xa.c | 2 +-
drivers/extcon/extcon-max14526.c | 2 +-
drivers/extcon/extcon-ptn5150.c | 2 +-
drivers/extcon/extcon-sm5502.c | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/extcon/extcon-fsa9480.c b/drivers/extcon/extcon-fsa9480.c
index a031eb0914a0..5de77ac5a294 100644
--- a/drivers/extcon/extcon-fsa9480.c
+++ b/drivers/extcon/extcon-fsa9480.c
@@ -350,8 +350,8 @@ static const struct dev_pm_ops fsa9480_pm_ops = {
};

static const struct i2c_device_id fsa9480_id[] = {
- { "fsa9480" },
- {}
+ { .name = "fsa9480" },
+ { }
};
MODULE_DEVICE_TABLE(i2c, fsa9480_id);

diff --git a/drivers/extcon/extcon-lc824206xa.c b/drivers/extcon/extcon-lc824206xa.c
index 56938748aea8..a758f2955207 100644
--- a/drivers/extcon/extcon-lc824206xa.c
+++ b/drivers/extcon/extcon-lc824206xa.c
@@ -475,7 +475,7 @@ static int lc824206xa_probe(struct i2c_client *client)
}

static const struct i2c_device_id lc824206xa_i2c_ids[] = {
- { "lc824206xa" },
+ { .name = "lc824206xa" },
{ }
};
MODULE_DEVICE_TABLE(i2c, lc824206xa_i2c_ids);
diff --git a/drivers/extcon/extcon-max14526.c b/drivers/extcon/extcon-max14526.c
index 3750a5c20612..2c337fd7214f 100644
--- a/drivers/extcon/extcon-max14526.c
+++ b/drivers/extcon/extcon-max14526.c
@@ -281,7 +281,7 @@ static const struct of_device_id max14526_match[] = {
MODULE_DEVICE_TABLE(of, max14526_match);

static const struct i2c_device_id max14526_id[] = {
- { "max14526" },
+ { .name = "max14526" },
{ }
};
MODULE_DEVICE_TABLE(i2c, max14526_id);
diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
index eca1b140aeb0..bcbd38ed0d0d 100644
--- a/drivers/extcon/extcon-ptn5150.c
+++ b/drivers/extcon/extcon-ptn5150.c
@@ -393,7 +393,7 @@ static const struct of_device_id ptn5150_dt_match[] = {
MODULE_DEVICE_TABLE(of, ptn5150_dt_match);

static const struct i2c_device_id ptn5150_i2c_id[] = {
- { "ptn5150" },
+ { .name = "ptn5150" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ptn5150_i2c_id);
diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index c8c4b9ef72aa..5661b57cbb45 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -827,9 +827,9 @@ static SIMPLE_DEV_PM_OPS(sm5502_muic_pm_ops,
sm5502_muic_suspend, sm5502_muic_resume);

static const struct i2c_device_id sm5502_i2c_id[] = {
- { "sm5502", (kernel_ulong_t)&sm5502_data },
- { "sm5504", (kernel_ulong_t)&sm5504_data },
- { "sm5703-muic", (kernel_ulong_t)&sm5502_data },
+ { .name = "sm5502", .driver_data = (kernel_ulong_t)&sm5502_data },
+ { .name = "sm5504", .driver_data = (kernel_ulong_t)&sm5504_data },
+ { .name = "sm5703-muic", .driver_data = (kernel_ulong_t)&sm5502_data },
{ }
};
MODULE_DEVICE_TABLE(i2c, sm5502_i2c_id);
--
2.47.3