Skip to content

Commit 3bf45fb

Browse files
andy-shevAndi Shyti
authored andcommitted
i2c: brcmstb: Use i2c_10bit_addr_*_from_msg() helpers
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-5-andriy.shevchenko@linux.intel.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent eaa0df0 commit 3bf45fb

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/i2c/busses/i2c-brcmstb.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,23 +414,22 @@ static int brcmstb_i2c_do_addr(struct brcmstb_i2c_dev *dev,
414414

415415
if (msg->flags & I2C_M_TEN) {
416416
/* First byte is 11110XX0 where XX is upper 2 bits */
417-
addr = 0xF0 | ((msg->addr & 0x300) >> 7);
417+
addr = i2c_10bit_addr_hi_from_msg(msg) & ~I2C_M_RD;
418418
bsc_writel(dev, addr, chip_address);
419419

420420
/* Second byte is the remaining 8 bits */
421-
addr = msg->addr & 0xFF;
421+
addr = i2c_10bit_addr_lo_from_msg(msg);
422422
if (brcmstb_i2c_write_data_byte(dev, &addr, 0) < 0)
423423
return -EREMOTEIO;
424424

425425
if (msg->flags & I2C_M_RD) {
426426
/* For read, send restart without stop condition */
427-
brcmstb_set_i2c_start_stop(dev, COND_RESTART
428-
| COND_NOSTOP);
427+
brcmstb_set_i2c_start_stop(dev, COND_RESTART | COND_NOSTOP);
428+
429429
/* Then re-send the first byte with the read bit set */
430-
addr = 0xF0 | ((msg->addr & 0x300) >> 7) | 0x01;
430+
addr = i2c_10bit_addr_hi_from_msg(msg);
431431
if (brcmstb_i2c_write_data_byte(dev, &addr, 0) < 0)
432432
return -EREMOTEIO;
433-
434433
}
435434
} else {
436435
addr = i2c_8bit_addr_from_msg(msg);

0 commit comments

Comments
 (0)