i2c: tegra-bpmp: don't modify input variable in xlate_flags
authorWolfram Sang <wsa@kernel.org>
Wed, 31 Mar 2021 07:51:40 +0000 (09:51 +0200)
committerWolfram Sang <wsa@kernel.org>
Mon, 5 Apr 2021 21:01:26 +0000 (23:01 +0200)
Since commit bc1c2048abbe ("i2c: bpmp-tegra: Ignore unknown I2C_M
flags") we don't need to mask out flags and can keep the input variable
as is to save quite some lines.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-tegra-bpmp.c

index c934d63..295286a 100644 (file)
@@ -40,45 +40,29 @@ struct tegra_bpmp_i2c {
  */
 static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
 {
-       if (flags & I2C_M_TEN) {
+       if (flags & I2C_M_TEN)
                *out |= SERIALI2C_TEN;
-               flags &= ~I2C_M_TEN;
-       }
 
-       if (flags & I2C_M_RD) {
+       if (flags & I2C_M_RD)
                *out |= SERIALI2C_RD;
-               flags &= ~I2C_M_RD;
-       }
 
-       if (flags & I2C_M_STOP) {
+       if (flags & I2C_M_STOP)
                *out |= SERIALI2C_STOP;
-               flags &= ~I2C_M_STOP;
-       }
 
-       if (flags & I2C_M_NOSTART) {
+       if (flags & I2C_M_NOSTART)
                *out |= SERIALI2C_NOSTART;
-               flags &= ~I2C_M_NOSTART;
-       }
 
-       if (flags & I2C_M_REV_DIR_ADDR) {
+       if (flags & I2C_M_REV_DIR_ADDR)
                *out |= SERIALI2C_REV_DIR_ADDR;
-               flags &= ~I2C_M_REV_DIR_ADDR;
-       }
 
-       if (flags & I2C_M_IGNORE_NAK) {
+       if (flags & I2C_M_IGNORE_NAK)
                *out |= SERIALI2C_IGNORE_NAK;
-               flags &= ~I2C_M_IGNORE_NAK;
-       }
 
-       if (flags & I2C_M_NO_RD_ACK) {
+       if (flags & I2C_M_NO_RD_ACK)
                *out |= SERIALI2C_NO_RD_ACK;
-               flags &= ~I2C_M_NO_RD_ACK;
-       }
 
-       if (flags & I2C_M_RECV_LEN) {
+       if (flags & I2C_M_RECV_LEN)
                *out |= SERIALI2C_RECV_LEN;
-               flags &= ~I2C_M_RECV_LEN;
-       }
 
        return 0;
 }