Re: [PATCH] I2C update for 2.6.7-rc1

From: Greg KH
Date: Fri May 28 2004 - 17:33:57 EST


ChangeSet 1.1717.6.28, 2004/05/19 00:26:34-07:00, ebs@xxxxxxxxxxx

[PATCH] I2C PPC4xx IIC driver: 0-length transaction temporary fix

this patch adds temporary fix for 0-length requests (e.g. SMBUS_QUICK) to PPC4xx
IIC driver. This i2c controller doesn't support such transactions and this patch
just restores previous driver version behavior making SMBUS_QUICK-based bus scan
at least partially usable. This is temporary kludge until correct bit-banging
emulation is implemented.


drivers/i2c/busses/i2c-ibm_iic.c | 10 ++++++++++
1 files changed, 10 insertions(+)


diff -Nru a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
--- a/drivers/i2c/busses/i2c-ibm_iic.c Fri May 28 14:52:12 2004
+++ b/drivers/i2c/busses/i2c-ibm_iic.c Fri May 28 14:52:12 2004
@@ -455,6 +455,16 @@
}
for (i = 0; i < num; ++i){
if (unlikely(msgs[i].len <= 0)){
+ if (num == 1 && !msgs[0].len){
+ /* Special case for I2C_SMBUS_QUICK emulation.
+ * Although this logic is FAR FROM PERFECT, this
+ * is what previous driver version did.
+ * IBM IIC doesn't support 0-length transactions
+ * (except bit-banging through IICx_DIRECTCNTL).
+ */
+ DBG("%d: zero-length msg kludge\n", dev->idx);
+ return 0;
+ }
DBG("%d: invalid len %d in msg[%d]\n", dev->idx,
msgs[i].len, i);
return -EINVAL;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/