Skip to content

Commit cc6bcf7

Browse files
sjchuJean Delvare
authored andcommitted
i2c-algo-bit: Generate correct i2c address sequence for 10-bit target
The wrong bits were put on the wire, fix that. This fixes kernel bug #42562. Signed-off-by: Sheng-Hui J. Chu <jeffchu@broadcom.com> Cc: stable@kernel.org Signed-off-by: Jean Delvare <khali@linux-fr.org>
1 parent b4bbb02 commit cc6bcf7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/i2c/algos/i2c-algo-bit.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
488488

489489
if (flags & I2C_M_TEN) {
490490
/* a ten bit address */
491-
addr = 0xf0 | ((msg->addr >> 7) & 0x03);
491+
addr = 0xf0 | ((msg->addr >> 7) & 0x06);
492492
bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr);
493493
/* try extended address code...*/
494494
ret = try_address(i2c_adap, addr, retries);
@@ -498,7 +498,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
498498
return -ENXIO;
499499
}
500500
/* the remaining 8 bit address */
501-
ret = i2c_outb(i2c_adap, msg->addr & 0x7f);
501+
ret = i2c_outb(i2c_adap, msg->addr & 0xff);
502502
if ((ret != 1) && !nak_ok) {
503503
/* the chip did not ack / xmission error occurred */
504504
dev_err(&i2c_adap->dev, "died at 2nd address code\n");

0 commit comments

Comments
 (0)