Commit d0b6b61e authored by Eugene Surovegin's avatar Eugene Surovegin Committed by Greg Kroah-Hartman

[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.
parent 1776ad0c
...@@ -455,6 +455,16 @@ static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) ...@@ -455,6 +455,16 @@ static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
} }
for (i = 0; i < num; ++i){ for (i = 0; i < num; ++i){
if (unlikely(msgs[i].len <= 0)){ 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, DBG("%d: invalid len %d in msg[%d]\n", dev->idx,
msgs[i].len, i); msgs[i].len, i);
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment