On Tue, May 19, 2026 at 05:01:56PM +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.
>
> While touching these arrays, unify usage of whitespace in the list
> terminator.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub)
> <[email protected]>
> ---
> 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/[email protected]/
> 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.
Yes, this doesn't seem so critical, but it's an improvement. This is in
my queue for next release.
Thanks,
-corey
>
> Best regards
> Uwe
>
> drivers/char/ipmi/ipmb_dev_int.c | 4 ++--
> drivers/char/ipmi/ipmi_ipmb.c | 4 ++--
> drivers/char/ipmi/ipmi_ssif.c | 2 +-
> drivers/char/ipmi/ssif_bmc.c | 2 +-
> 4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmb_dev_int.c
> b/drivers/char/ipmi/ipmb_dev_int.c
> index 2fe1d205ce4e..680ff15c30ab 100644
> --- a/drivers/char/ipmi/ipmb_dev_int.c
> +++ b/drivers/char/ipmi/ipmb_dev_int.c
> @@ -353,8 +353,8 @@ static void ipmb_remove(struct i2c_client *client)
> }
>
> static const struct i2c_device_id ipmb_id[] = {
> - { "ipmb-dev" },
> - {}
> + { .name = "ipmb-dev" },
> + { }
> };
> MODULE_DEVICE_TABLE(i2c, ipmb_id);
>
> diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
> index 28818952a7a4..1f1e5718f082 100644
> --- a/drivers/char/ipmi/ipmi_ipmb.c
> +++ b/drivers/char/ipmi/ipmi_ipmb.c
> @@ -566,8 +566,8 @@ MODULE_DEVICE_TABLE(of, of_ipmi_ipmb_match);
> #endif
>
> static const struct i2c_device_id ipmi_ipmb_id[] = {
> - { DEVICE_NAME },
> - {}
> + { .name = DEVICE_NAME },
> + { }
> };
> MODULE_DEVICE_TABLE(i2c, ipmi_ipmb_id);
>
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index b49500a1bd36..32460c3858f4 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -2074,7 +2074,7 @@ static int dmi_ipmi_probe(struct platform_device *pdev)
> #endif
>
> static const struct i2c_device_id ssif_id[] = {
> - { DEVICE_NAME },
> + { .name = DEVICE_NAME },
> { }
> };
> MODULE_DEVICE_TABLE(i2c, ssif_id);
> diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
> index 1df0e9284ad9..6036897725f3 100644
> --- a/drivers/char/ipmi/ssif_bmc.c
> +++ b/drivers/char/ipmi/ssif_bmc.c
> @@ -874,7 +874,7 @@ static const struct of_device_id ssif_bmc_match[] = {
> MODULE_DEVICE_TABLE(of, ssif_bmc_match);
>
> static const struct i2c_device_id ssif_bmc_id[] = {
> - { DEVICE_NAME },
> + { .name = DEVICE_NAME },
> { }
> };
> MODULE_DEVICE_TABLE(i2c, ssif_bmc_id);
>
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> --
> 2.47.3
>
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer