Updated from Linux LTS 3.10.21 to 3.10.22
This commit is contained in:
@@ -43,6 +43,9 @@
|
||||
#include "lgs8gxx.h"
|
||||
#include "atbm8830.h"
|
||||
|
||||
/* Max transfer size done by I2C transfer functions */
|
||||
#define MAX_XFER_SIZE 64
|
||||
|
||||
/* debug */
|
||||
static int dvb_usb_cxusb_debug;
|
||||
module_param_named(debug, dvb_usb_cxusb_debug, int, 0644);
|
||||
@@ -57,7 +60,14 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d,
|
||||
u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
|
||||
{
|
||||
int wo = (rbuf == NULL || rlen == 0); /* write-only */
|
||||
u8 sndbuf[1+wlen];
|
||||
u8 sndbuf[MAX_XFER_SIZE];
|
||||
|
||||
if (1 + wlen > sizeof(sndbuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
wlen);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
memset(sndbuf, 0, 1+wlen);
|
||||
|
||||
sndbuf[0] = cmd;
|
||||
@@ -158,7 +168,13 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
|
||||
if (msg[i].flags & I2C_M_RD) {
|
||||
/* read only */
|
||||
u8 obuf[3], ibuf[1+msg[i].len];
|
||||
u8 obuf[3], ibuf[MAX_XFER_SIZE];
|
||||
|
||||
if (1 + msg[i].len > sizeof(ibuf)) {
|
||||
warn("i2c rd: len=%d is too big!\n",
|
||||
msg[i].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
obuf[0] = 0;
|
||||
obuf[1] = msg[i].len;
|
||||
obuf[2] = msg[i].addr;
|
||||
@@ -172,7 +188,18 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
} else if (i+1 < num && (msg[i+1].flags & I2C_M_RD) &&
|
||||
msg[i].addr == msg[i+1].addr) {
|
||||
/* write to then read from same address */
|
||||
u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len];
|
||||
u8 obuf[MAX_XFER_SIZE], ibuf[MAX_XFER_SIZE];
|
||||
|
||||
if (3 + msg[i].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[i].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
if (1 + msg[i + 1].len > sizeof(ibuf)) {
|
||||
warn("i2c rd: len=%d is too big!\n",
|
||||
msg[i + 1].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
obuf[0] = msg[i].len;
|
||||
obuf[1] = msg[i+1].len;
|
||||
obuf[2] = msg[i].addr;
|
||||
@@ -191,7 +218,13 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
i++;
|
||||
} else {
|
||||
/* write only */
|
||||
u8 obuf[2+msg[i].len], ibuf;
|
||||
u8 obuf[MAX_XFER_SIZE], ibuf;
|
||||
|
||||
if (2 + msg[i].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[i].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
obuf[0] = msg[i].addr;
|
||||
obuf[1] = msg[i].len;
|
||||
memcpy(&obuf[2], msg[i].buf, msg[i].len);
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <linux/kconfig.h>
|
||||
#include "dibusb.h"
|
||||
|
||||
/* Max transfer size done by I2C transfer functions */
|
||||
#define MAX_XFER_SIZE 64
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=info (|-able))." DVB_USB_DEBUG_STATUS);
|
||||
@@ -105,11 +108,16 @@ EXPORT_SYMBOL(dibusb2_0_power_ctrl);
|
||||
static int dibusb_i2c_msg(struct dvb_usb_device *d, u8 addr,
|
||||
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
|
||||
{
|
||||
u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */
|
||||
u8 sndbuf[MAX_XFER_SIZE]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */
|
||||
/* write only ? */
|
||||
int wo = (rbuf == NULL || rlen == 0),
|
||||
len = 2 + wlen + (wo ? 0 : 2);
|
||||
|
||||
if (4 + wlen > sizeof(sndbuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n", wlen);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ;
|
||||
sndbuf[1] = (addr << 1) | (wo ? 0 : 1);
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
#include "stb6100_proc.h"
|
||||
#include "m88rs2000.h"
|
||||
|
||||
/* Max transfer size done by I2C transfer functions */
|
||||
#define MAX_XFER_SIZE 64
|
||||
|
||||
#ifndef USB_PID_DW2102
|
||||
#define USB_PID_DW2102 0x2102
|
||||
#endif
|
||||
@@ -308,7 +311,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms
|
||||
case 2: {
|
||||
/* read */
|
||||
/* first write first register number */
|
||||
u8 ibuf[msg[1].len + 2], obuf[3];
|
||||
u8 ibuf[MAX_XFER_SIZE], obuf[3];
|
||||
|
||||
if (2 + msg[1].len > sizeof(ibuf)) {
|
||||
warn("i2c rd: len=%d is too big!\n",
|
||||
msg[1].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
obuf[0] = msg[0].addr << 1;
|
||||
obuf[1] = msg[0].len;
|
||||
obuf[2] = msg[0].buf[0];
|
||||
@@ -325,7 +335,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms
|
||||
switch (msg[0].addr) {
|
||||
case 0x68: {
|
||||
/* write to register */
|
||||
u8 obuf[msg[0].len + 2];
|
||||
u8 obuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[0].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[1].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
obuf[0] = msg[0].addr << 1;
|
||||
obuf[1] = msg[0].len;
|
||||
memcpy(obuf + 2, msg[0].buf, msg[0].len);
|
||||
@@ -335,7 +352,14 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg ms
|
||||
}
|
||||
case 0x61: {
|
||||
/* write to tuner */
|
||||
u8 obuf[msg[0].len + 2];
|
||||
u8 obuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[0].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[1].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
obuf[0] = msg[0].addr << 1;
|
||||
obuf[1] = msg[0].len;
|
||||
memcpy(obuf + 2, msg[0].buf, msg[0].len);
|
||||
@@ -401,7 +425,14 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i
|
||||
default: {
|
||||
if (msg[j].flags == I2C_M_RD) {
|
||||
/* read registers */
|
||||
u8 ibuf[msg[j].len + 2];
|
||||
u8 ibuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[j].len > sizeof(ibuf)) {
|
||||
warn("i2c rd: len=%d is too big!\n",
|
||||
msg[j].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
dw210x_op_rw(d->udev, 0xc3,
|
||||
(msg[j].addr << 1) + 1, 0,
|
||||
ibuf, msg[j].len + 2,
|
||||
@@ -430,7 +461,14 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], i
|
||||
} while (len > 0);
|
||||
} else {
|
||||
/* write registers */
|
||||
u8 obuf[msg[j].len + 2];
|
||||
u8 obuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[j].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[j].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
obuf[0] = msg[j].addr << 1;
|
||||
obuf[1] = msg[j].len;
|
||||
memcpy(obuf + 2, msg[j].buf, msg[j].len);
|
||||
@@ -463,7 +501,13 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
case 2: {
|
||||
/* read */
|
||||
/* first write first register number */
|
||||
u8 ibuf[msg[1].len + 2], obuf[3];
|
||||
u8 ibuf[MAX_XFER_SIZE], obuf[3];
|
||||
|
||||
if (2 + msg[1].len > sizeof(ibuf)) {
|
||||
warn("i2c rd: len=%d is too big!\n",
|
||||
msg[1].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
obuf[0] = msg[0].addr << 1;
|
||||
obuf[1] = msg[0].len;
|
||||
obuf[2] = msg[0].buf[0];
|
||||
@@ -481,7 +525,13 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
case 0x60:
|
||||
case 0x0c: {
|
||||
/* write to register */
|
||||
u8 obuf[msg[0].len + 2];
|
||||
u8 obuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[0].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[0].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
obuf[0] = msg[0].addr << 1;
|
||||
obuf[1] = msg[0].len;
|
||||
memcpy(obuf + 2, msg[0].buf, msg[0].len);
|
||||
@@ -563,7 +613,14 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
default: {
|
||||
if (msg[j].flags == I2C_M_RD) {
|
||||
/* read registers */
|
||||
u8 ibuf[msg[j].len];
|
||||
u8 ibuf[MAX_XFER_SIZE];
|
||||
|
||||
if (msg[j].len > sizeof(ibuf)) {
|
||||
warn("i2c rd: len=%d is too big!\n",
|
||||
msg[j].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
dw210x_op_rw(d->udev, 0x91, 0, 0,
|
||||
ibuf, msg[j].len,
|
||||
DW210X_READ_MSG);
|
||||
@@ -590,7 +647,14 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
} while (len > 0);
|
||||
} else if (j < (num - 1)) {
|
||||
/* write register addr before read */
|
||||
u8 obuf[msg[j].len + 2];
|
||||
u8 obuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[j].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[j].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
obuf[0] = msg[j + 1].len;
|
||||
obuf[1] = (msg[j].addr << 1);
|
||||
memcpy(obuf + 2, msg[j].buf, msg[j].len);
|
||||
@@ -602,7 +666,13 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
||||
break;
|
||||
} else {
|
||||
/* write registers */
|
||||
u8 obuf[msg[j].len + 2];
|
||||
u8 obuf[MAX_XFER_SIZE];
|
||||
|
||||
if (2 + msg[j].len > sizeof(obuf)) {
|
||||
warn("i2c wr: len=%d is too big!\n",
|
||||
msg[j].len);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
obuf[0] = msg[j].len + 1;
|
||||
obuf[1] = (msg[j].addr << 1);
|
||||
memcpy(obuf + 2, msg[j].buf, msg[j].len);
|
||||
|
||||
Reference in New Issue
Block a user