Skip to content

Commit 59ccb81

Browse files
CraftyChimeraWolfram Sang
authored andcommitted
i2c: mux: Simplify boolean assignment in i2c_mux_alloc
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> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
1 parent 2b7a200 commit 59ccb81

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/i2c/i2c-mux.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,9 @@ struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
241241

242242
muxc->parent = parent;
243243
muxc->dev = dev;
244-
if (flags & I2C_MUX_LOCKED)
245-
muxc->mux_locked = true;
246-
if (flags & I2C_MUX_ARBITRATOR)
247-
muxc->arbitrator = true;
248-
if (flags & I2C_MUX_GATE)
249-
muxc->gate = true;
244+
muxc->mux_locked = !!(flags & I2C_MUX_LOCKED);
245+
muxc->arbitrator = !!(flags & I2C_MUX_ARBITRATOR);
246+
muxc->gate = !!(flags & I2C_MUX_GATE);
250247
muxc->select = select;
251248
muxc->deselect = deselect;
252249
muxc->max_adapters = max_adapters;

0 commit comments

Comments
 (0)