All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: i801: Simplify initialization of i2c_board_info in i801_probe_optional_slaves
Date: Mon, 14 Jun 2021 18:07:10 +0200	[thread overview]
Message-ID: <20210614180710.1a4b662e@endymion> (raw)
In-Reply-To: <c2c797f9-7c5c-9545-0cac-675a191c7e40@gmail.com>

On Tue, 25 May 2021 22:01:31 +0200, Heiner Kallweit wrote:
> Why shall we bother to open-code something that the compiler can do for us.

I don't know, maybe it wasn't supported by older versions of gcc?

Surprisingly, this makes the binary a tad larger. I wonder why.

> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/i2c/busses/i2c-i801.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 9588d5bcf..0c08cfec5 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1291,11 +1291,11 @@ static void i801_probe_optional_slaves(struct i801_priv *priv)
>  		return;
>  
>  	if (apanel_addr) {
> -		struct i2c_board_info info;
> +		struct i2c_board_info info = {

Could be declared const now?

> +			.addr = apanel_addr,
> +			.type = "fujitsu_apanel"

We traditionally add a trailing comma on every line, so that adding a
line in the future will result in a smaller, more readable patch.

> +		};
>  
> -		memset(&info, 0, sizeof(struct i2c_board_info));
> -		info.addr = apanel_addr;
> -		strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
>  		i2c_new_client_device(&priv->adapter, &info);
>  	}
>  

Other than these minor details, no objection from me.

Reviewed-by: Jean Delvare <jdelvare@suse.de>

-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2021-06-14 16:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 20:01 [PATCH] i2c: i801: Simplify initialization of i2c_board_info in i801_probe_optional_slaves Heiner Kallweit
2021-06-14 16:07 ` Jean Delvare [this message]
2021-06-20 20:53 ` Wolfram Sang

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=20210614180710.1a4b662e@endymion \
    --to=jdelvare@suse.de \
    --cc=hkallweit1@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    /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.