Linux-i2c Archive mirror
 help / color / mirror / Atom feed
From: "Hsin-Yu.Chen" <harry021633@gmail.com>
To: wsa+renesas@sang-engineering.com
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Hsin-Yu.Chen" <harry021633@gmail.com>
Subject: [PATCH] i2c: remove redundant condition
Date: Wed,  6 Mar 2024 00:56:52 +0800	[thread overview]
Message-ID: <20240305165652.18842-1-harry021633@gmail.com> (raw)

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

Signed-off-by: Hsin-Yu.Chen <harry021633@gmail.com>
---
 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-05 16:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 16:56 Hsin-Yu.Chen [this message]
2024-03-06  1:32 ` [PATCH] i2c: remove redundant condition Andi Shyti
  -- 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=20240305165652.18842-1-harry021633@gmail.com \
    --to=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).