summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-03-12 08:13:12 -0700
committerTrent Piepho <xyzzy@speakeasy.org>2007-03-12 08:13:12 -0700
commited98e2514b5928698127958acf047de216986cb9 (patch)
tree55b732030acfff2da7cc6fea7ae8cd95c810f5a1 /linux/drivers/media/dvb/dvb-usb
parent2182011a1e9d29322026654f1f01cef05b907931 (diff)
downloadmediapointer-dvb-s2-ed98e2514b5928698127958acf047de216986cb9.tar.gz
mediapointer-dvb-s2-ed98e2514b5928698127958acf047de216986cb9.tar.bz2
m920x: Detect zero-length I2C messages and fix a typo
From: Trent Piepho <xyzzy@speakeasy.org> Change a 00 to just 0 Detect zero-length I2C messages and return not supported. I think I know how to send one, but the problem is getting the slave's ack. The only point of a zero-length message is for probing; too see if the slave will ack its address. Since we don't know how to get the ack, we can't support zero-length messages in a useful way, so it's probably best to just return not supported for them. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'linux/drivers/media/dvb/dvb-usb')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/m920x.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/m920x.c b/linux/drivers/media/dvb/dvb-usb/m920x.c
index f0814c4c3..e63f1edba 100644
--- a/linux/drivers/media/dvb/dvb-usb/m920x.c
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.c
@@ -148,13 +148,18 @@ static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
return -EAGAIN;
for (i = 0; i < num; i++) {
- if (msg[i].flags & (I2C_M_NO_RD_ACK|I2C_M_IGNORE_NAK|I2C_M_TEN)) {
+ if (msg[i].flags & (I2C_M_NO_RD_ACK|I2C_M_IGNORE_NAK|I2C_M_TEN) ||
+ msg[i].len == 0) {
+ /* For a 0 byte message, I think sending the address to index 0x80|0x40
+ * would be the correct thing to do. However, zero byte messages are
+ * only used for probing, and since we don't know how to get the slave's
+ * ack, we can't probe. */
ret = -ENOTSUPP;
goto unlock;
}
/* Send START & address/RW bit */
if (!(msg[i].flags & I2C_M_NOSTART)) {
- if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:00), 0x80)) != 0)
+ if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), 0x80)) != 0)
goto unlock;
/* Should check for ack here, if we knew how. */
}