Linux-i2c Archive mirror
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: "Hsin-Yu.Chen" <harry021633@gmail.com>
Cc: wsa+renesas@sang-engineering.com, linux-i2c@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: remove redundant condition
Date: Wed, 6 Mar 2024 02:32:20 +0100	[thread overview]
Message-ID: <ev25m7yfkcpe3s5bjuhio77kz27m7ibejhalpea224u53q74qf@oa7dzhsply7m> (raw)
In-Reply-To: <20240305165652.18842-1-harry021633@gmail.com>

Hi Hsin-Yu,

On Wed, Mar 06, 2024 at 12:56:52AM +0800, Hsin-Yu.Chen wrote:
> I2C_M_RD is defined as 1 and `flag & I2C_M_RD` is one or zero
> no need one more condition to get the value

this can be written a bit better as:

/no need one more/no need for an additional/

> Signed-off-by: Hsin-Yu.Chen <harry021633@gmail.com>

anyway:

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Thanks,
Andi

> ---
>  include/linux/i2c.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 652ecb7abeda..363dde9ef94f 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -931,7 +931,7 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
>  
>  static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg)
>  {
> -	return (msg->addr << 1) | (msg->flags & I2C_M_RD ? 1 : 0);
> +	return (msg->addr << 1) | (msg->flags & I2C_M_RD);
>  }
>  
>  u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold);
> -- 
> 2.38.1
> 

  reply	other threads:[~2024-03-06  1:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 16:56 [PATCH] i2c: remove redundant condition Hsin-Yu.Chen
2024-03-06  1:32 ` Andi Shyti [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-06  4:19 Hsin-Yu.Chen
2024-03-07  8:37 ` Wolfram Sang
2024-02-24 11:50 zoanana990
2024-03-04 20:54 ` 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=ev25m7yfkcpe3s5bjuhio77kz27m7ibejhalpea224u53q74qf@oa7dzhsply7m \
    --to=andi.shyti@kernel.org \
    --cc=harry021633@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).