aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-03-22 01:48:35 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-03-23 09:24:30 -0500
commit9aa45e34d2948f360f8c0e63d10f49015ca51edd (patch)
tree52b5715c005a81989e0d3660bcffa0a6a9ed0e34 /drivers/media
parent5a313c59bcc5062fc56088d5ff9289828c4b6626 (diff)
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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/adv7170.c17
-rw-r--r--drivers/media/video/adv7175.c17
-rw-r--r--drivers/media/video/bt819.c17
-rw-r--r--drivers/media/video/saa7110.c7
-rw-r--r--drivers/media/video/saa7111.c17
-rw-r--r--drivers/media/video/saa7114.c17
-rw-r--r--drivers/media/video/saa7185.c17
7 files changed, 43 insertions, 66 deletions
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
index 4ce07ae62dac..d18bf9097dc9 100644
--- a/drivers/media/video/adv7170.c
+++ b/drivers/media/video/adv7170.c
@@ -125,24 +125,21 @@ adv7170_write_block (struct i2c_client *client,
125 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 125 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
126 /* do raw I2C, not smbus compatible */ 126 /* do raw I2C, not smbus compatible */
127 struct adv7170 *encoder = i2c_get_clientdata(client); 127 struct adv7170 *encoder = i2c_get_clientdata(client);
128 struct i2c_msg msg;
129 u8 block_data[32]; 128 u8 block_data[32];
129 int block_len;
130 130
131 msg.addr = client->addr;
132 msg.flags = 0;
133 while (len >= 2) { 131 while (len >= 2) {
134 msg.buf = (char *) block_data; 132 block_len = 0;
135 msg.len = 0; 133 block_data[block_len++] = reg = data[0];
136 block_data[msg.len++] = reg = data[0];
137 do { 134 do {
138 block_data[msg.len++] = 135 block_data[block_len++] =
139 encoder->reg[reg++] = data[1]; 136 encoder->reg[reg++] = data[1];
140 len -= 2; 137 len -= 2;
141 data += 2; 138 data += 2;
142 } while (len >= 2 && data[0] == reg && 139 } while (len >= 2 && data[0] == reg &&
143 msg.len < 32); 140 block_len < 32);
144 if ((ret = i2c_transfer(client->adapter, 141 if ((ret = i2c_master_send(client, block_data,
145 &msg, 1)) < 0) 142 block_len)) < 0)
146 break; 143 break;
147 } 144 }
148 } else { 145 } else {
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index ca86de0c2805..1a2b111897d5 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -115,24 +115,21 @@ adv7175_write_block (struct i2c_client *client,
115 * the adapter understands raw I2C */ 115 * the adapter understands raw I2C */
116 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 116 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
117 /* do raw I2C, not smbus compatible */ 117 /* do raw I2C, not smbus compatible */
118 struct i2c_msg msg;
119 u8 block_data[32]; 118 u8 block_data[32];
119 int block_len;
120 120
121 msg.addr = client->addr;
122 msg.flags = 0;
123 while (len >= 2) { 121 while (len >= 2) {
124 msg.buf = (char *) block_data; 122 block_len = 0;
125 msg.len = 0; 123 block_data[block_len++] = reg = data[0];
126 block_data[msg.len++] = reg = data[0];
127 do { 124 do {
128 block_data[msg.len++] = data[1]; 125 block_data[block_len++] = data[1];
129 reg++; 126 reg++;
130 len -= 2; 127 len -= 2;
131 data += 2; 128 data += 2;
132 } while (len >= 2 && data[0] == reg && 129 } while (len >= 2 && data[0] == reg &&
133 msg.len < 32); 130 block_len < 32);
134 if ((ret = i2c_transfer(client->adapter, 131 if ((ret = i2c_master_send(client, block_data,
135 &msg, 1)) < 0) 132 block_len)) < 0)
136 break; 133 break;
137 } 134 }
138 } else { 135 } else {
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
index d6447791d0e5..c2c450fbf683 100644
--- a/drivers/media/video/bt819.c
+++ b/drivers/media/video/bt819.c
@@ -141,24 +141,21 @@ bt819_write_block (struct i2c_client *client,
141 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 141 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
142 /* do raw I2C, not smbus compatible */ 142 /* do raw I2C, not smbus compatible */
143 struct bt819 *decoder = i2c_get_clientdata(client); 143 struct bt819 *decoder = i2c_get_clientdata(client);
144 struct i2c_msg msg;
145 u8 block_data[32]; 144 u8 block_data[32];
145 int block_len;
146 146
147 msg.addr = client->addr;
148 msg.flags = 0;
149 while (len >= 2) { 147 while (len >= 2) {
150 msg.buf = (char *) block_data; 148 block_len = 0;
151 msg.len = 0; 149 block_data[block_len++] = reg = data[0];
152 block_data[msg.len++] = reg = data[0];
153 do { 150 do {
154 block_data[msg.len++] = 151 block_data[block_len++] =
155 decoder->reg[reg++] = data[1]; 152 decoder->reg[reg++] = data[1];
156 len -= 2; 153 len -= 2;
157 data += 2; 154 data += 2;
158 } while (len >= 2 && data[0] == reg && 155 } while (len >= 2 && data[0] == reg &&
159 msg.len < 32); 156 block_len < 32);
160 if ((ret = i2c_transfer(client->adapter, 157 if ((ret = i2c_master_send(client, block_data,
161 &msg, 1)) < 0) 158 block_len)) < 0)
162 break; 159 break;
163 } 160 }
164 } else { 161 } else {
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
index 20cad9fc99ef..36123fa0b63f 100644
--- a/drivers/media/video/saa7110.c
+++ b/drivers/media/video/saa7110.c
@@ -108,13 +108,8 @@ saa7110_write_block (struct i2c_client *client,
108 * the adapter understands raw I2C */ 108 * the adapter understands raw I2C */
109 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 109 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
110 struct saa7110 *decoder = i2c_get_clientdata(client); 110 struct saa7110 *decoder = i2c_get_clientdata(client);
111 struct i2c_msg msg;
112 111
113 msg.len = len; 112 ret = i2c_master_send(client, data, len);
114 msg.buf = (char *) data;
115 msg.addr = client->addr;
116 msg.flags = 0;
117 ret = i2c_transfer(client->adapter, &msg, 1);
118 113
119 /* Cache the written data */ 114 /* Cache the written data */
120 memcpy(decoder->reg + reg, data + 1, len - 1); 115 memcpy(decoder->reg + reg, data + 1, len - 1);
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
index 6bd1789c8f78..cb27917c376a 100644
--- a/drivers/media/video/saa7111.c
+++ b/drivers/media/video/saa7111.c
@@ -112,24 +112,21 @@ saa7111_write_block (struct i2c_client *client,
112 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 112 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
113 /* do raw I2C, not smbus compatible */ 113 /* do raw I2C, not smbus compatible */
114 struct saa7111 *decoder = i2c_get_clientdata(client); 114 struct saa7111 *decoder = i2c_get_clientdata(client);
115 struct i2c_msg msg;
116 u8 block_data[32]; 115 u8 block_data[32];
116 int block_len;
117 117
118 msg.addr = client->addr;
119 msg.flags = 0;
120 while (len >= 2) { 118 while (len >= 2) {
121 msg.buf = (char *) block_data; 119 block_len = 0;
122 msg.len = 0; 120 block_data[block_len++] = reg = data[0];
123 block_data[msg.len++] = reg = data[0];
124 do { 121 do {
125 block_data[msg.len++] = 122 block_data[block_len++] =
126 decoder->reg[reg++] = data[1]; 123 decoder->reg[reg++] = data[1];
127 len -= 2; 124 len -= 2;
128 data += 2; 125 data += 2;
129 } while (len >= 2 && data[0] == reg && 126 } while (len >= 2 && data[0] == reg &&
130 msg.len < 32); 127 block_len < 32);
131 if ((ret = i2c_transfer(client->adapter, 128 if ((ret = i2c_master_send(client, block_data,
132 &msg, 1)) < 0) 129 block_len)) < 0)
133 break; 130 break;
134 } 131 }
135 } else { 132 } else {
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
index 1c29d05307a5..849b54cd5c24 100644
--- a/drivers/media/video/saa7114.c
+++ b/drivers/media/video/saa7114.c
@@ -154,24 +154,21 @@ saa7114_write_block (struct i2c_client *client,
154 * the adapter understands raw I2C */ 154 * the adapter understands raw I2C */
155 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 155 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
156 /* do raw I2C, not smbus compatible */ 156 /* do raw I2C, not smbus compatible */
157 struct i2c_msg msg;
158 u8 block_data[32]; 157 u8 block_data[32];
158 int block_len;
159 159
160 msg.addr = client->addr;
161 msg.flags = 0;
162 while (len >= 2) { 160 while (len >= 2) {
163 msg.buf = (char *) block_data; 161 block_len = 0;
164 msg.len = 0; 162 block_data[block_len++] = reg = data[0];
165 block_data[msg.len++] = reg = data[0];
166 do { 163 do {
167 block_data[msg.len++] = data[1]; 164 block_data[block_len++] = data[1];
168 reg++; 165 reg++;
169 len -= 2; 166 len -= 2;
170 data += 2; 167 data += 2;
171 } while (len >= 2 && data[0] == reg && 168 } while (len >= 2 && data[0] == reg &&
172 msg.len < 32); 169 block_len < 32);
173 if ((ret = i2c_transfer(client->adapter, 170 if ((ret = i2c_master_send(client, block_data,
174 &msg, 1)) < 0) 171 block_len)) < 0)
175 break; 172 break;
176 } 173 }
177 } else { 174 } else {
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
index 3ed0edb870a4..67dfa7186453 100644
--- a/drivers/media/video/saa7185.c
+++ b/drivers/media/video/saa7185.c
@@ -113,24 +113,21 @@ saa7185_write_block (struct i2c_client *client,
113 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 113 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
114 /* do raw I2C, not smbus compatible */ 114 /* do raw I2C, not smbus compatible */
115 struct saa7185 *encoder = i2c_get_clientdata(client); 115 struct saa7185 *encoder = i2c_get_clientdata(client);
116 struct i2c_msg msg;
117 u8 block_data[32]; 116 u8 block_data[32];
117 int block_len;
118 118
119 msg.addr = client->addr;
120 msg.flags = 0;
121 while (len >= 2) { 119 while (len >= 2) {
122 msg.buf = (char *) block_data; 120 block_len = 0;
123 msg.len = 0; 121 block_data[block_len++] = reg = data[0];
124 block_data[msg.len++] = reg = data[0];
125 do { 122 do {
126 block_data[msg.len++] = 123 block_data[block_len++] =
127 encoder->reg[reg++] = data[1]; 124 encoder->reg[reg++] = data[1];
128 len -= 2; 125 len -= 2;
129 data += 2; 126 data += 2;
130 } while (len >= 2 && data[0] == reg && 127 } while (len >= 2 && data[0] == reg &&
131 msg.len < 32); 128 block_len < 32);
132 if ((ret = i2c_transfer(client->adapter, 129 if ((ret = i2c_master_send(client, block_data,
133 &msg, 1)) < 0) 130 block_len)) < 0)
134 break; 131 break;
135 } 132 }
136 } else { 133 } else {