Skip to content

Commit 2ee4415

Browse files
andy-shevAndi Shyti
authored andcommitted
i2c: ibm_iic: Use i2c_*bit_addr*_from_msg() helpers
Use i2c_*bit_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-10-andriy.shevchenko@linux.intel.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent dbb1c2e commit 2ee4415

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

drivers/i2c/busses/i2c-ibm_iic.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,19 +512,17 @@ static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm,
512512
static inline void iic_address(struct ibm_iic_private* dev, struct i2c_msg* msg)
513513
{
514514
volatile struct iic_regs __iomem *iic = dev->vaddr;
515-
u16 addr = msg->addr;
516515

517516
DBG2("%d: iic_address, 0x%03x (%d-bit)\n", dev->idx,
518-
addr, msg->flags & I2C_M_TEN ? 10 : 7);
517+
msg->addr, msg->flags & I2C_M_TEN ? 10 : 7);
519518

520-
if (msg->flags & I2C_M_TEN){
519+
if (msg->flags & I2C_M_TEN) {
521520
out_8(&iic->cntl, CNTL_AMD);
522-
out_8(&iic->lmadr, addr);
523-
out_8(&iic->hmadr, 0xf0 | ((addr >> 7) & 0x06));
524-
}
525-
else {
521+
out_8(&iic->lmadr, i2c_10bit_addr_lo_from_msg(msg));
522+
out_8(&iic->hmadr, i2c_10bit_addr_hi_from_msg(msg) & ~I2C_M_RD);
523+
} else {
526524
out_8(&iic->cntl, 0);
527-
out_8(&iic->lmadr, addr << 1);
525+
out_8(&iic->lmadr, i2c_8bit_addr_from_msg(msg) & ~I2C_M_RD);
528526
}
529527
}
530528

0 commit comments

Comments
 (0)