V4L/DVB (3568k): zoran: Use i2c_master_send when possible

Change all the Zoran (ZR36050/ZR36060) drivers to use i2c_master_send instead
of i2c_transfer when possible.  This simplifies the code by a few lines in
each driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Jean Delvare 2006-03-22 03:48:35 -03:00 committed by Mauro Carvalho Chehab
parent 5a313c59bc
commit 9aa45e34d2
7 changed files with 43 additions and 66 deletions

View File

@ -125,24 +125,21 @@ adv7170_write_block (struct i2c_client *client,
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
/* do raw I2C, not smbus compatible */
struct adv7170 *encoder = i2c_get_clientdata(client);
struct i2c_msg msg;
u8 block_data[32];
int block_len;
msg.addr = client->addr;
msg.flags = 0;
while (len >= 2) {
msg.buf = (char *) block_data;
msg.len = 0;
block_data[msg.len++] = reg = data[0];
block_len = 0;
block_data[block_len++] = reg = data[0];
do {
block_data[msg.len++] =
block_data[block_len++] =
encoder->reg[reg++] = data[1];
len -= 2;
data += 2;
} while (len >= 2 && data[0] == reg &&
msg.len < 32);
if ((ret = i2c_transfer(client->adapter,
&msg, 1)) < 0)
block_len < 32);
if ((ret = i2c_master_send(client, block_data,
block_len)) < 0)
break;
}
} else {

View File

@ -115,24 +115,21 @@ adv7175_write_block (struct i2c_client *client,
* the adapter understands raw I2C */
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
/* do raw I2C, not smbus compatible */
struct i2c_msg msg;
u8 block_data[32];
int block_len;
msg.addr = client->addr;
msg.flags = 0;
while (len >= 2) {
msg.buf = (char *) block_data;
msg.len = 0;
block_data[msg.len++] = reg = data[0];
block_len = 0;
block_data[block_len++] = reg = data[0];
do {
block_data[msg.len++] = data[1];
block_data[block_len++] = data[1];
reg++;
len -= 2;
data += 2;
} while (len >= 2 && data[0] == reg &&
msg.len < 32);
if ((ret = i2c_transfer(client->adapter,
&msg, 1)) < 0)
block_len < 32);
if ((ret = i2c_master_send(client, block_data,
block_len)) < 0)
break;
}
} else {

View File

@ -141,24 +141,21 @@ bt819_write_block (struct i2c_client *client,
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
/* do raw I2C, not smbus compatible */
struct bt819 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg;
u8 block_data[32];
int block_len;
msg.addr = client->addr;
msg.flags = 0;
while (len >= 2) {
msg.buf = (char *) block_data;
msg.len = 0;
block_data[msg.len++] = reg = data[0];
block_len = 0;
block_data[block_len++] = reg = data[0];
do {
block_data[msg.len++] =
block_data[block_len++] =
decoder->reg[reg++] = data[1];
len -= 2;
data += 2;
} while (len >= 2 && data[0] == reg &&
msg.len < 32);
if ((ret = i2c_transfer(client->adapter,
&msg, 1)) < 0)
block_len < 32);
if ((ret = i2c_master_send(client, block_data,
block_len)) < 0)
break;
}
} else {

View File

@ -108,13 +108,8 @@ saa7110_write_block (struct i2c_client *client,
* the adapter understands raw I2C */
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
struct saa7110 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg;
msg.len = len;
msg.buf = (char *) data;
msg.addr = client->addr;
msg.flags = 0;
ret = i2c_transfer(client->adapter, &msg, 1);
ret = i2c_master_send(client, data, len);
/* Cache the written data */
memcpy(decoder->reg + reg, data + 1, len - 1);

View File

@ -112,24 +112,21 @@ saa7111_write_block (struct i2c_client *client,
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
/* do raw I2C, not smbus compatible */
struct saa7111 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg;
u8 block_data[32];
int block_len;
msg.addr = client->addr;
msg.flags = 0;
while (len >= 2) {
msg.buf = (char *) block_data;
msg.len = 0;
block_data[msg.len++] = reg = data[0];
block_len = 0;
block_data[block_len++] = reg = data[0];
do {
block_data[msg.len++] =
block_data[block_len++] =
decoder->reg[reg++] = data[1];
len -= 2;
data += 2;
} while (len >= 2 && data[0] == reg &&
msg.len < 32);
if ((ret = i2c_transfer(client->adapter,
&msg, 1)) < 0)
block_len < 32);
if ((ret = i2c_master_send(client, block_data,
block_len)) < 0)
break;
}
} else {

View File

@ -154,24 +154,21 @@ saa7114_write_block (struct i2c_client *client,
* the adapter understands raw I2C */
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
/* do raw I2C, not smbus compatible */
struct i2c_msg msg;
u8 block_data[32];
int block_len;
msg.addr = client->addr;
msg.flags = 0;
while (len >= 2) {
msg.buf = (char *) block_data;
msg.len = 0;
block_data[msg.len++] = reg = data[0];
block_len = 0;
block_data[block_len++] = reg = data[0];
do {
block_data[msg.len++] = data[1];
block_data[block_len++] = data[1];
reg++;
len -= 2;
data += 2;
} while (len >= 2 && data[0] == reg &&
msg.len < 32);
if ((ret = i2c_transfer(client->adapter,
&msg, 1)) < 0)
block_len < 32);
if ((ret = i2c_master_send(client, block_data,
block_len)) < 0)
break;
}
} else {

View File

@ -113,24 +113,21 @@ saa7185_write_block (struct i2c_client *client,
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
/* do raw I2C, not smbus compatible */
struct saa7185 *encoder = i2c_get_clientdata(client);
struct i2c_msg msg;
u8 block_data[32];
int block_len;
msg.addr = client->addr;
msg.flags = 0;
while (len >= 2) {
msg.buf = (char *) block_data;
msg.len = 0;
block_data[msg.len++] = reg = data[0];
block_len = 0;
block_data[block_len++] = reg = data[0];
do {
block_data[msg.len++] =
block_data[block_len++] =
encoder->reg[reg++] = data[1];
len -= 2;
data += 2;
} while (len >= 2 && data[0] == reg &&
msg.len < 32);
if ((ret = i2c_transfer(client->adapter,
&msg, 1)) < 0)
block_len < 32);
if ((ret = i2c_master_send(client, block_data,
block_len)) < 0)
break;
}
} else {