Commit 44835f19 authored by Jean Delvare's avatar Jean Delvare Committed by Mauro Carvalho Chehab

V4L/DVB: cx23885: Check for slave nack on all transactions

Don't just check for nacks on zero-length transactions. Check on
other transactions too.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarAndy Walls <awalls@md.metrocast.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f4acb3c4
...@@ -125,6 +125,10 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, ...@@ -125,6 +125,10 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
goto err; goto err;
if (retval == 0) if (retval == 0)
goto eio; goto eio;
if (!i2c_slave_did_ack(i2c_adap)) {
retval = -ENXIO;
goto err;
}
if (i2c_debug) { if (i2c_debug) {
printk(" <W %02x %02x", msg->addr << 1, msg->buf[0]); printk(" <W %02x %02x", msg->addr << 1, msg->buf[0]);
if (!(ctrl & I2C_NOSTOP)) if (!(ctrl & I2C_NOSTOP))
...@@ -214,6 +218,10 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, ...@@ -214,6 +218,10 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
goto err; goto err;
if (retval == 0) if (retval == 0)
goto eio; goto eio;
if (cnt == 0 && !i2c_slave_did_ack(i2c_adap)) {
retval = -ENXIO;
goto err;
}
msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff;
if (i2c_debug) { if (i2c_debug) {
dprintk(1, " %02x", msg->buf[cnt]); dprintk(1, " %02x", msg->buf[cnt]);
......
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