mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] platform: arm64 Use named initializers for struct i2c_device_id
@ 2026-05-19 14:43 Uwe Kleine-König (The Capable Hub)
  2026-05-20  8:04 ` Bryan O'Donoghue
  2026-05-28 12:11 ` Ilpo Järvinen
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-19 14:43 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen
  Cc: Bryan O'Donoghue, Pengyu Luo, Sebastian Reichel,
	platform-driver-x86, 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.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

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

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
Hello,

this patch is part of a bigger quest to use named initializers for
mainly struct i2c_device_id::driver_data to be able to modify
i2c_device_id. See e.g.
https://lore.kernel.org/all/20260518111203.639603-2-u.kleine-koenig@baylibre.com/
for the details.

This patch here isn't critical for this quest, as no driver makes use of
.driver_data, so apart from the better readability this is only about
consistency with other subsystems.

Best regards
Uwe
---
 drivers/platform/arm64/acer-aspire1-ec.c      | 2 +-
 drivers/platform/arm64/huawei-gaokun-ec.c     | 2 +-
 drivers/platform/arm64/lenovo-thinkpad-t14s.c | 4 ++--
 drivers/platform/arm64/lenovo-yoga-c630.c     | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/arm64/acer-aspire1-ec.c b/drivers/platform/arm64/acer-aspire1-ec.c
index 438532a047e6..08d0b155a197 100644
--- a/drivers/platform/arm64/acer-aspire1-ec.c
+++ b/drivers/platform/arm64/acer-aspire1-ec.c
@@ -532,7 +532,7 @@ static int aspire_ec_resume(struct device *dev)
 }
 
 static const struct i2c_device_id aspire_ec_id[] = {
-	{ "aspire1-ec", },
+	{ .name = "aspire1-ec" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, aspire_ec_id);
diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c b/drivers/platform/arm64/huawei-gaokun-ec.c
index a83ddc20b5a3..80a8ba8b8dda 100644
--- a/drivers/platform/arm64/huawei-gaokun-ec.c
+++ b/drivers/platform/arm64/huawei-gaokun-ec.c
@@ -795,7 +795,7 @@ static int gaokun_ec_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id gaokun_ec_id[] = {
-	{ "gaokun-ec", },
+	{ .name = "gaokun-ec" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, gaokun_ec_id);
diff --git a/drivers/platform/arm64/lenovo-thinkpad-t14s.c b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
index 5590302a5694..e7acb66b77f2 100644
--- a/drivers/platform/arm64/lenovo-thinkpad-t14s.c
+++ b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
@@ -637,8 +637,8 @@ static const struct of_device_id t14s_ec_of_match[] = {
 MODULE_DEVICE_TABLE(of, t14s_ec_of_match);
 
 static const struct i2c_device_id t14s_ec_i2c_id_table[] = {
-	{ "thinkpad-t14s-ec", },
-	{}
+	{ .name = "thinkpad-t14s-ec" },
+	{ }
 };
 MODULE_DEVICE_TABLE(i2c, t14s_ec_i2c_id_table);
 
diff --git a/drivers/platform/arm64/lenovo-yoga-c630.c b/drivers/platform/arm64/lenovo-yoga-c630.c
index 75060c842b24..a8600a977fbc 100644
--- a/drivers/platform/arm64/lenovo-yoga-c630.c
+++ b/drivers/platform/arm64/lenovo-yoga-c630.c
@@ -238,8 +238,8 @@ static const struct of_device_id yoga_c630_ec_of_match[] = {
 MODULE_DEVICE_TABLE(of, yoga_c630_ec_of_match);
 
 static const struct i2c_device_id yoga_c630_ec_i2c_id_table[] = {
-	{ "yoga-c630-ec", },
-	{}
+	{ .name = "yoga-c630-ec" },
+	{ }
 };
 MODULE_DEVICE_TABLE(i2c, yoga_c630_ec_i2c_id_table);
 

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] platform: arm64 Use named initializers for struct i2c_device_id
  2026-05-19 14:43 [PATCH v1] platform: arm64 Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
@ 2026-05-20  8:04 ` Bryan O'Donoghue
  2026-05-28 12:11 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Bryan O'Donoghue @ 2026-05-20  8:04 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub),
	Hans de Goede, Ilpo Järvinen
  Cc: Pengyu Luo, Sebastian Reichel, platform-driver-x86, linux-kernel

On 19/05/2026 15:43, Uwe Kleine-König (The Capable Hub) wrote:
> 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.
> 
> While touching all these arrays, unify usage of whitespace in the list
> terminator.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> this patch is part of a bigger quest to use named initializers for
> mainly struct i2c_device_id::driver_data to be able to modify
> i2c_device_id. See e.g.
> https://lore.kernel.org/all/20260518111203.639603-2-u.kleine-koenig@baylibre.com/
> for the details.
> 
> This patch here isn't critical for this quest, as no driver makes use of
> .driver_data, so apart from the better readability this is only about
> consistency with other subsystems.
> 
> Best regards
> Uwe
> ---
>   drivers/platform/arm64/acer-aspire1-ec.c      | 2 +-
>   drivers/platform/arm64/huawei-gaokun-ec.c     | 2 +-
>   drivers/platform/arm64/lenovo-thinkpad-t14s.c | 4 ++--
>   drivers/platform/arm64/lenovo-yoga-c630.c     | 4 ++--
>   4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/arm64/acer-aspire1-ec.c b/drivers/platform/arm64/acer-aspire1-ec.c
> index 438532a047e6..08d0b155a197 100644
> --- a/drivers/platform/arm64/acer-aspire1-ec.c
> +++ b/drivers/platform/arm64/acer-aspire1-ec.c
> @@ -532,7 +532,7 @@ static int aspire_ec_resume(struct device *dev)
>   }
>   
>   static const struct i2c_device_id aspire_ec_id[] = {
> -	{ "aspire1-ec", },
> +	{ .name = "aspire1-ec" },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(i2c, aspire_ec_id);
> diff --git a/drivers/platform/arm64/huawei-gaokun-ec.c b/drivers/platform/arm64/huawei-gaokun-ec.c
> index a83ddc20b5a3..80a8ba8b8dda 100644
> --- a/drivers/platform/arm64/huawei-gaokun-ec.c
> +++ b/drivers/platform/arm64/huawei-gaokun-ec.c
> @@ -795,7 +795,7 @@ static int gaokun_ec_probe(struct i2c_client *client)
>   }
>   
>   static const struct i2c_device_id gaokun_ec_id[] = {
> -	{ "gaokun-ec", },
> +	{ .name = "gaokun-ec" },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(i2c, gaokun_ec_id);
> diff --git a/drivers/platform/arm64/lenovo-thinkpad-t14s.c b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
> index 5590302a5694..e7acb66b77f2 100644
> --- a/drivers/platform/arm64/lenovo-thinkpad-t14s.c
> +++ b/drivers/platform/arm64/lenovo-thinkpad-t14s.c
> @@ -637,8 +637,8 @@ static const struct of_device_id t14s_ec_of_match[] = {
>   MODULE_DEVICE_TABLE(of, t14s_ec_of_match);
>   
>   static const struct i2c_device_id t14s_ec_i2c_id_table[] = {
> -	{ "thinkpad-t14s-ec", },
> -	{}
> +	{ .name = "thinkpad-t14s-ec" },
> +	{ }
>   };
>   MODULE_DEVICE_TABLE(i2c, t14s_ec_i2c_id_table);
>   
> diff --git a/drivers/platform/arm64/lenovo-yoga-c630.c b/drivers/platform/arm64/lenovo-yoga-c630.c
> index 75060c842b24..a8600a977fbc 100644
> --- a/drivers/platform/arm64/lenovo-yoga-c630.c
> +++ b/drivers/platform/arm64/lenovo-yoga-c630.c
> @@ -238,8 +238,8 @@ static const struct of_device_id yoga_c630_ec_of_match[] = {
>   MODULE_DEVICE_TABLE(of, yoga_c630_ec_of_match);
>   
>   static const struct i2c_device_id yoga_c630_ec_i2c_id_table[] = {
> -	{ "yoga-c630-ec", },
> -	{}
> +	{ .name = "yoga-c630-ec" },
> +	{ }
>   };
>   MODULE_DEVICE_TABLE(i2c, yoga_c630_ec_i2c_id_table);
>   
> 
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

---
bod

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] platform: arm64 Use named initializers for struct i2c_device_id
  2026-05-19 14:43 [PATCH v1] platform: arm64 Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
  2026-05-20  8:04 ` Bryan O'Donoghue
@ 2026-05-28 12:11 ` Ilpo Järvinen
  1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2026-05-28 12:11 UTC (permalink / raw)
  To: Hans de Goede, Uwe Kleine-König (The Capable Hub)
  Cc: Bryan O'Donoghue, Pengyu Luo, Sebastian Reichel,
	platform-driver-x86, linux-kernel

On Tue, 19 May 2026 16:43:41 +0200, Uwe Kleine-König (The Capable Hub) wrote:

> 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.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform: arm64 Use named initializers for struct i2c_device_id
      commit: fbab18baaf9a3fe45c6fd75dab7f5b7f6992356f

--
 i.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-28 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-19 14:43 [PATCH v1] platform: arm64 Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-20  8:04 ` Bryan O'Donoghue
2026-05-28 12:11 ` Ilpo Järvinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®