Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76436
b: refs/heads/master
c: 272479d
h: refs/heads/master
v: v3
  • Loading branch information
Chris Pascoe authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 688cbbc commit 0cd2001
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 13e001dfe3aeb9e7b05445af76e5b47235e81285
refs/heads/master: 272479d7ab067344d118e7633b624bf98f8896f3
20 changes: 17 additions & 3 deletions trunk/drivers/media/dvb/dvb-usb/cxusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 0cd2001

Please sign in to comment.