linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c-mux: Simplify boolean assignment in i2c_mux_alloc
@ 2025-08-24 18:14 I Viswanath
  2025-08-25  1:30 ` Akhilesh Patil
  0 siblings, 1 reply; 3+ messages in thread
From: I Viswanath @ 2025-08-24 18:14 UTC (permalink / raw)
  To: peda; +Cc: wsa+renesas, linux-i2c, skhan, linux-kernel-mentees, I Viswanath

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-25  3:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-24 18:14 [PATCH] i2c: i2c-mux: Simplify boolean assignment in i2c_mux_alloc I Viswanath
2025-08-25  1:30 ` Akhilesh Patil
2025-08-25  3:14   ` [PATCH v2] " I Viswanath

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