All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <corey@minyard.net>
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] ipmi: Use named initializers for struct i2c_device_id
Date: Tue, 19 May 2026 12:34:18 -0500	[thread overview]
Message-ID: <agyfGrjUfbZOcVJu@mail.minyard.net> (raw)
In-Reply-To: <20260519150156.1590826-2-u.kleine-koenig@baylibre.com>

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) <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.

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
> 

      reply	other threads:[~2026-05-19 17:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 15:01 [PATCH v1] ipmi: Use named initializers for struct i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-05-19 17:34 ` Corey Minyard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=agyfGrjUfbZOcVJu@mail.minyard.net \
    --to=corey@minyard.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.