Skip to contentSkip to conversation

i2c: fix scx200_acb functionalities

PATCH New Jean Delvare 1 participant 2 messages Jun 7, 2006 – Jun 8, 2006

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

PATCH 1/1 i2c: fix scx200_acb functionalities

Greg,

Can you please push this to Linus as soon as possible? It would be nice to have this fix in 2.6.17 (and -stable too.)

The scx200_acb advertises SMBus block transactions as supported. In fact, it supports SMBus block writes, but not SMBus block reads which are more complex to implement.

This fixes an oops reported by Alexander Atanasov:
http://marc.theaimsgroup.com/?l=linux-kernel&m4970382125094

Signed-off-by Jean Delvare <khali at linux-fr.org>
Acked-by Jordan Crouse <jordan.crouse at amd.com>
---
 drivers/i2c/busses/scx200_acb.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/i2c/busses/scx200_acb.c +7 -1
@@ -305,6 +305,12 @@
 		break;
 
 	case I2C_SMBUS_BLOCK_DATA:
+		/* Sanity check */
+		if (rw = I2C_SMBUS_READ) {
+			dev_warn(&adapter->dev, "SMBus block read is not "
+				 "supported!\n");
+			return -EINVAL;
+		}
 		len = data->block[0];
 		buffer = &data->block[1];
 		break;
@@ -369,7 +375,7 @@
 {
 	return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
 	       I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
-	       I2C_FUNC_SMBUS_BLOCK_DATA;
+	       I2C_FUNC_SMBUS_WRITE_BLOCK_DATA;
 }
 
 /* For now, we only handle combined mode (smbus) */
Signature · 1 line
Jean Delvare
#1 lore raw

PATCH 1/1 i2c: fix scx200_acb functionalities

Greg,

Quoting myself:

Quoted 10 lines

Can you please push this to Linus as soon as possible? It would be nice to have this fix in 2.6.17 (and -stable too.)

The scx200_acb advertises SMBus block transactions as supported. In fact, it supports SMBus block writes, but not SMBus block reads which are more complex to implement.

This fixes an oops reported by Alexander Atanasov:
http://marc.theaimsgroup.com/?l=linux-kernel&m4970382125094

Huh, please hold on, my fix seems to be incomplete.

Signature · 1 line
Jean Delvare