linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: I Viswanath <viswanathiyyappan@gmail.com>
To: peda@axentia.se
Cc: wsa+renesas@sang-engineering.com, linux-i2c@vger.kernel.org,
	skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev,
	I Viswanath <viswanathiyyappan@gmail.com>
Subject: [PATCH] i2c: i2c-mux: Simplify boolean assignment in i2c_mux_alloc
Date: Sun, 24 Aug 2025 23:44:16 +0530	[thread overview]
Message-ID: <20250824181416.4316-1-viswanathiyyappan@gmail.com> (raw)

Refactor boolean field assignments of the form `if (a) b = true` to `b = a`
in i2c_mux_alloc

Signed-off-by: I Viswanath <viswanathiyyappan@gmail.com>
---
 drivers/i2c/i2c-mux.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 4d8690981a55..abf63758856b 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -241,12 +241,9 @@ struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
 
 	muxc->parent = parent;
 	muxc->dev = dev;
-	if (flags & I2C_MUX_LOCKED)
-		muxc->mux_locked = true;
-	if (flags & I2C_MUX_ARBITRATOR)
-		muxc->arbitrator = true;
-	if (flags & I2C_MUX_GATE)
-		muxc->gate = true;
+	muxc->mux_locked = flags & I2C_MUX_LOCKED;
+	muxc->arbitrator = flags & I2C_MUX_ARBITRATOR;
+	muxc->gate = flags & I2C_MUX_GATE;
 	muxc->select = select;
 	muxc->deselect = deselect;
 	muxc->max_adapters = max_adapters;
-- 
2.50.1


             reply	other threads:[~2025-08-24 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-24 18:14 I Viswanath [this message]
2025-08-25  1:30 ` [PATCH] i2c: i2c-mux: Simplify boolean assignment in i2c_mux_alloc Akhilesh Patil
2025-08-25  3:14   ` [PATCH v2] " I Viswanath

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=20250824181416.4316-1-viswanathiyyappan@gmail.com \
    --to=viswanathiyyappan@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=peda@axentia.se \
    --cc=skhan@linuxfoundation.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 NNTP newsgroup(s).