Skip to contentSkip to conversation

i2c: i801: Fix a refactoring that broke a touchpad on Lenovo P1

PATCH Applied Maxim Levitsky 3 participants 3 messages Mar 21, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: i801: Fix a refactoring that broke a touchpad on Lenovo P1

Commit 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len") introduced a slight functional change: the status variable is now overwritten with the length of an SMBUS tranasaction, even in case of success.

This breaks the touchpad on at least my Lenovo P1:

rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: RMI initial reset failed! Continuing in spite of this. rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: IRQ counting failed with code -6.

Fixes 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len")
---
 drivers/i2c/busses/i2c-i801.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-i801.c +4 -3
index a6861660cb8c..79870dd7a014 100644
@@ -536,11 +536,12 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,
 
 	if (read_write == I2C_SMBUS_READ ||
 	    command == I2C_SMBUS_BLOCK_PROC_CALL) {
-		status = i801_get_block_len(priv);
-		if (status < 0)
+		len = i801_get_block_len(priv);
+		if (len < 0) {
+			status = len;
 			goto out;
+		}
 
-		len = status;
 		data->block[0] = len;
 		inb_p(SMBHSTCNT(priv));	/* reset the data buffer index */
 		for (i = 0; i < len; i++)
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Maxim Levitsky

Commit 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len") introduced a slight functional change: the status variable is now overwritten with the length of an SMBUS tranasaction, even in case of success.

This breaks the touchpad on at least my Lenovo P1:

rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: RMI initial reset failed! Continuing in spite of this. rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: IRQ counting failed with code -6.

Fixes 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len")
---
 drivers/i2c/busses/i2c-i801.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-i801.c +0 -2
index a6861660cb8c..79870dd7a014 100644
@@ -536,11 +536,12 @@ static int i801_block_transaction_by_block(struct i801_priv *priv,
 
 	if (read_write == I2C_SMBUS_READ ||
 	    command == I2C_SMBUS_BLOCK_PROC_CALL) {
-		status = i801_get_block_len(priv);
-		if (status < 0)

drivers/i2c/busses/i2c-i801.c static int i801_block_transaction_by_block(struct i801_priv *priv, · line 547

Quoted 10 lines
drivers/i2c/busses/i2c-i801.c +4 -1
+		len = i801_get_block_len(priv);
+		if (len < 0) {
+			status = len;
 			goto out;
+		}
 
-		len = status;
 		data->block[0] = len;
 		inb_p(SMBHSTCNT(priv));	/* reset the data buffer index */
 		for (i = 0; i < len; i++)

Indeed, my bad.

maintainer Applied
#2 lore raw
In reply to Maxim Levitsky

Hi Maxim,

Quoted 5 lines · Maxim Levitsky

Commit 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len") introduced a slight functional change: the status variable is now overwritten with the length of an SMBUS tranasaction, even in case of success.

Quoted 9 lines

This breaks the touchpad on at least my Lenovo P1:

rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: RMI initial reset failed! Continuing in spite of this. rmi4_physical rmi4-00: Read PDT entry at 0x00e9 failed, code: -6. rmi4_physical rmi4-00: IRQ counting failed with code -6.

Fixes 857cc04cdf50 ("i2c: i801: Add helper i801_get_block_len")

next time please drop this blank line here.

Applied to i2c/i2c-host-fixes on

git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Thank you,
Andi

Patches applied
===============
[1/1] i2c: i801: Fix a refactoring that broke a touchpad on Lenovo P1

      commit: a5894bc48f64caa86dbea1744d067c925303c5fc