i2c: bcm-kona: Use i2c_10bit_addr_*_from_msg() helpers
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 13 Feb 2025 14:07:17 +0000 (16:07 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 18 Mar 2025 20:53:54 +0000 (21:53 +0100)
Use i2c_10bit_addr_*_from_msg() helpers instead of local copy.
No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250213141045.2716943-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-bcm-kona.c

index 340fe1305dd924adc5e3ce59e75a5e08be2a76e3..9d8838bbd938bf6c43d9553d9f54acac1282f7e8 100644 (file)
@@ -471,12 +471,12 @@ static int bcm_kona_i2c_do_addr(struct bcm_kona_i2c_dev *dev,
 
        if (msg->flags & I2C_M_TEN) {
                /* First byte is 11110XX0 where XX is upper 2 bits */
-               addr = 0xF0 | ((msg->addr & 0x300) >> 7);
+               addr = i2c_10bit_addr_hi_from_msg(msg) & ~I2C_M_RD;
                if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
                        return -EREMOTEIO;
 
                /* Second byte is the remaining 8 bits */
-               addr = msg->addr & 0xFF;
+               addr = i2c_10bit_addr_lo_from_msg(msg);
                if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
                        return -EREMOTEIO;
 
@@ -486,7 +486,7 @@ static int bcm_kona_i2c_do_addr(struct bcm_kona_i2c_dev *dev,
                                return -EREMOTEIO;
 
                        /* Then re-send the first byte with the read bit set */
-                       addr = 0xF0 | ((msg->addr & 0x300) >> 7) | 0x01;
+                       addr = i2c_10bit_addr_hi_from_msg(msg);
                        if (bcm_kona_i2c_write_byte(dev, addr, 0) < 0)
                                return -EREMOTEIO;
                }