* [PATCH v1 1/2] extcon: rt8973: Drop unused driver data
2026-05-18 10:41 [PATCH v1 0/2] extcon: Rework initialization of i2c_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-05-18 10:41 ` Uwe Kleine-König (The Capable Hub)
2026-05-18 10:41 ` [PATCH v1 2/2] extcon: Use named initializers for arrays of i2c_device_data Uwe Kleine-König (The Capable Hub)
2026-06-10 17:10 ` [PATCH v1 0/2] extcon: Rework initialization of i2c_device_id Uwe Kleine-König (The Capable Hub)
2 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-18 10:41 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi; +Cc: linux-kernel
The .driver_data member isn't used in this driver, so the explicit
assignment can safely be dropped. Also drop the enum after its only user
is gone.
While touching this i2c_device_id array, assign .name using a named
initializer which makes it easier to understand and more robust to
changes in the definition of struct i2c_device_id.
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
drivers/extcon/extcon-rt8973a.c | 2 +-
drivers/extcon/extcon-rt8973a.h | 4 ----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
index 19bb49f13fb0..dfeedb295c51 100644
--- a/drivers/extcon/extcon-rt8973a.c
+++ b/drivers/extcon/extcon-rt8973a.c
@@ -684,7 +684,7 @@ static SIMPLE_DEV_PM_OPS(rt8973a_muic_pm_ops,
rt8973a_muic_suspend, rt8973a_muic_resume);
static const struct i2c_device_id rt8973a_i2c_id[] = {
- { "rt8973a", TYPE_RT8973A },
+ { .name = "rt8973a" },
{ }
};
MODULE_DEVICE_TABLE(i2c, rt8973a_i2c_id);
diff --git a/drivers/extcon/extcon-rt8973a.h b/drivers/extcon/extcon-rt8973a.h
index 0d0d69fcac92..039af2d1cac6 100644
--- a/drivers/extcon/extcon-rt8973a.h
+++ b/drivers/extcon/extcon-rt8973a.h
@@ -8,10 +8,6 @@
#ifndef __LINUX_EXTCON_RT8973A_H
#define __LINUX_EXTCON_RT8973A_H
-enum rt8973a_types {
- TYPE_RT8973A,
-};
-
/* RT8973A registers */
enum rt8973A_reg {
RT8973A_REG_DEVICE_ID = 0x1,
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v1 2/2] extcon: Use named initializers for arrays of i2c_device_data
2026-05-18 10:41 [PATCH v1 0/2] extcon: Rework initialization of i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-18 10:41 ` [PATCH v1 1/2] extcon: rt8973: Drop unused driver data Uwe Kleine-König (The Capable Hub)
@ 2026-05-18 10:41 ` Uwe Kleine-König (The Capable Hub)
2026-06-10 17:10 ` [PATCH v1 0/2] extcon: Rework initialization of i2c_device_id Uwe Kleine-König (The Capable Hub)
2 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-18 10:41 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi; +Cc: Krzysztof Kozlowski, linux-kernel
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>
---
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v1 0/2] extcon: Rework initialization of i2c_device_id
2026-05-18 10:41 [PATCH v1 0/2] extcon: Rework initialization of i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-18 10:41 ` [PATCH v1 1/2] extcon: rt8973: Drop unused driver data Uwe Kleine-König (The Capable Hub)
2026-05-18 10:41 ` [PATCH v1 2/2] extcon: Use named initializers for arrays of i2c_device_data Uwe Kleine-König (The Capable Hub)
@ 2026-06-10 17:10 ` Uwe Kleine-König (The Capable Hub)
2026-07-17 10:31 ` Uwe Kleine-König (The Capable Hub)
2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-10 17:10 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi; +Cc: linux-kernel, Krzysztof Kozlowski
[-- Attachment #1: Type: text/plain, Size: 866 bytes --]
On Mon, May 18, 2026 at 12:41:43PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> Hello,
>
> I plan to do the following to the definition of i2c_device_id:
>
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 23ff24080dfd..aebd3a5e90af 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -477,7 +477,11 @@ struct rpmsg_device_id {
>
> struct i2c_device_id {
> char name[I2C_NAME_SIZE];
> - kernel_ulong_t driver_data; /* Data private to the driver */
> + union {
> + /* Data private to the driver */
> + kernel_ulong_t driver_data;
> + const void *driver_data_ptr;
> + };
> };
>
> /* pci_epf */
I want to work on that, but I'd need this patch series to be in for it.
Do you still have this patch on your radar?
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread