diff mbox series

[v3,03/11] i2c: npcm: Fix client address calculation

Message ID 20220303083141.8742-4-warp5tw@gmail.com
State New
Headers show
Series [v3,01/11] arm: dts: add new property for NPCM i2c module | expand

Commit Message

Tyrone Ting March 3, 2022, 8:31 a.m. UTC
From: Tali Perry <tali.perry1@gmail.com>

Fix i2c client address by left-shifting 1 bit before
applying it to the data register.

Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
Signed-off-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Tyrone Ting <kfting@nuvoton.com>
---
 drivers/i2c/busses/i2c-npcm7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tyrone Ting March 4, 2022, 1:39 p.m. UTC | #1
Hi Andy:

Thank you for your comment and it'll be addressed.

Andy Shevchenko <andriy.shevchenko@linux.intel.com> 於 2022年3月3日 週四 下午6:31寫道:
>
> On Thu, Mar 03, 2022 at 04:31:33PM +0800, Tyrone Ting wrote:
> > From: Tali Perry <tali.perry1@gmail.com>
> >
> > Fix i2c client address by left-shifting 1 bit before
> > applying it to the data register.
>
> ...
>
> > -     bus->dest_addr = slave_addr;
> > +     bus->dest_addr = slave_addr << 1;
>
> 1. Why this is not using i2c_8bit_addr_from_msg() helper?
> 2. This is duplication of what npcm_i2c_master_start_xmit() does.
>
> Taking 2 into account, what is this exactly fixing?
> Sounds like a red herring.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Best regards,
Tyrone
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 2ad166355ec9..4c225e1a058f 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2131,7 +2131,7 @@  static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 	}
 
 	npcm_i2c_init_params(bus);
-	bus->dest_addr = slave_addr;
+	bus->dest_addr = slave_addr << 1;
 	bus->msgs = msgs;
 	bus->msgs_num = num;
 	bus->cmd_err = 0;