diff options
author | Chris Pascoe <c.pascoe@itee.uq.edu.au> | 2007-11-19 01:05:09 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:02:20 -0500 |
commit | a644e4a3e95f8ca6eca019c92d8dfde101150687 (patch) | |
tree | fd99aabaf1ab9e1bb1d88f98918f3ee4e08f9de3 /drivers/media | |
parent | 272479d7ab067344d118e7633b624bf98f8896f3 (diff) |
V4L/DVB (6627): CXUSB: handle write then read from different address
The path to perform a read immediately after a write was not checking that
the address being read from was the same as the one that was written.
Handling this case correctly should mean that we now can handle more than
two i2c messages at a time.
Signed-off-by: Chris Pascoe <c.pascoe@itee.uq.edu.au>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 016a3780b714..74eeb168f241 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -83,9 +83,6 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
83 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 83 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
84 | return -EAGAIN; | 84 | return -EAGAIN; |
85 | 85 | ||
86 | if (num > 2) | ||
87 | warn("more than two i2c messages at a time is not handled yet. TODO."); | ||
88 | |||
89 | for (i = 0; i < num; i++) { | 86 | for (i = 0; i < num; i++) { |
90 | 87 | ||
91 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) | 88 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) |
@@ -111,8 +108,9 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], | |||
111 | break; | 108 | break; |
112 | } | 109 | } |
113 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); | 110 | memcpy(msg[i].buf, &ibuf[1], msg[i].len); |
114 | } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 111 | } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) && |
115 | /* write then read */ | 112 | msg[i].addr == msg[i+1].addr) { |
113 | /* write to then read from same address */ | ||
116 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; | 114 | u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len]; |
117 | obuf[0] = msg[i].len; | 115 | obuf[0] = msg[i].len; |
118 | obuf[1] = msg[i+1].len; | 116 | obuf[1] = msg[i+1].len; |