Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=272479d7ab067344d118e7633b624bf98f8896f3
Commit:     272479d7ab067344d118e7633b624bf98f8896f3
Parent:     13e001dfe3aeb9e7b05445af76e5b47235e81285
Author:     Chris Pascoe <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 19 03:01:22 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:02:20 2008 -0200

    V4L/DVB (6626): CXUSB: support only-read i2c requests
    
    Any i2c read request that was not immediately preceded by a write request 
was
    incorrectly taking the write path.  Add the capability to handle individual
    read requests.
    
    Signed-off-by: Chris Pascoe <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/dvb-usb/cxusb.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/cxusb.c 
b/drivers/media/dvb/dvb-usb/cxusb.c
index 86fbd6c..016a378 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -98,8 +98,21 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
                                break;
                        }
 
-               /* read request */
-               if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
+               if (msg[i].flags & I2C_M_RD) {
+                       /* read only */
+                       u8 obuf[3], ibuf[1+msg[i].len];
+                       obuf[0] = 0;
+                       obuf[1] = msg[i].len;
+                       obuf[2] = msg[i].addr;
+                       if (cxusb_ctrl_msg(d, CMD_I2C_READ,
+                                          obuf, 3,
+                                          ibuf, 1+msg[i].len) < 0) {
+                               warn("i2c read failed");
+                               break;
+                       }
+                       memcpy(msg[i].buf, &ibuf[1], msg[i].len);
+               } else if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
+                       /* write then read */
                        u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len];
                        obuf[0] = msg[i].len;
                        obuf[1] = msg[i+1].len;
@@ -117,7 +130,8 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct 
i2c_msg msg[],
                        memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
 
                        i++;
-               } else { /* write */
+               } else {
+                       /* write only */
                        u8 obuf[2+msg[i].len], ibuf;
                        obuf[0] = msg[i].addr;
                        obuf[1] = msg[i].len;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to