diff options
author | Hsin-Yu.Chen <harry021633@gmail.com> | 2024-03-06 12:19:00 +0800 |
---|---|---|
committer | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2024-03-07 09:36:08 +0100 |
commit | f311507c5336ad6b9ca7687c35c3bd7a4fe2868c (patch) | |
tree | fb396fc74d02818fd46b41dfe014ba06071ff645 /include/linux/i2c.h | |
parent | 8821c8376993c271a77d241a4e657099f7400974 (diff) |
i2c: remove redundant condition
I2C_M_RD is defined as and guaranteed to be 1 and 'flag & I2C_M_RD' is
one or zero. No need for an additional condition to obtain the value.
Signed-off-by: Hsin-Yu.Chen <harry021633@gmail.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
[wsa: slightly updated commit message]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index ff93ff8b257c..5e6cd43a6dbd 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); |