aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7111.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 19:23:20 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 19:23:20 -0500
commit88f07ffb63add018bfafd480ec6a294088277f06 (patch)
tree64b657d06b3ae7de3f87544a85d83d0ed6a7e3a9 /drivers/media/video/saa7111.c
parentb6585dedac232ca79fe978d97a95fdaa6da24f66 (diff)
parent9aa45e34d2948f360f8c0e63d10f49015ca51edd (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: V4L/DVB (3568k): zoran: Use i2c_master_send when possible V4L/DVB (3568j): adv7175: Drop unused encoder dump command V4L/DVB (3568i): adv7175: Drop unused register cache V4L/DVB (3568h): cpia: correct email address V4L/DVB (3568g): sem2mutex: zoran V4L/DVB (3568f): saa7110: Fix array overrun V4L/DVB (3568e): bt856: Spare memory V4L/DVB (3568d): saa7111.c fix V4L/DVB (3568c): zoran: Init cleanups V4L/DVB (3568b): saa7111: Prevent array overrun V4L/DVB (3568a): saa7114: Fix i2c block write
Diffstat (limited to 'drivers/media/video/saa7111.c')
-rw-r--r--drivers/media/video/saa7111.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
index 5e06cc98442d..f9ba0c943adf 100644
--- a/drivers/media/video/saa7111.c
+++ b/drivers/media/video/saa7111.c
@@ -69,8 +69,10 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
69 69
70/* ----------------------------------------------------------------------- */ 70/* ----------------------------------------------------------------------- */
71 71
72#define SAA7111_NR_REG 0x18
73
72struct saa7111 { 74struct saa7111 {
73 unsigned char reg[32]; 75 unsigned char reg[SAA7111_NR_REG];
74 76
75 int norm; 77 int norm;
76 int input; 78 int input;
@@ -109,24 +111,21 @@ saa7111_write_block (struct i2c_client *client,
109 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 111 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
110 /* do raw I2C, not smbus compatible */ 112 /* do raw I2C, not smbus compatible */
111 struct saa7111 *decoder = i2c_get_clientdata(client); 113 struct saa7111 *decoder = i2c_get_clientdata(client);
112 struct i2c_msg msg;
113 u8 block_data[32]; 114 u8 block_data[32];
115 int block_len;
114 116
115 msg.addr = client->addr;
116 msg.flags = 0;
117 while (len >= 2) { 117 while (len >= 2) {
118 msg.buf = (char *) block_data; 118 block_len = 0;
119 msg.len = 0; 119 block_data[block_len++] = reg = data[0];
120 block_data[msg.len++] = reg = data[0];
121 do { 120 do {
122 block_data[msg.len++] = 121 block_data[block_len++] =
123 decoder->reg[reg++] = data[1]; 122 decoder->reg[reg++] = data[1];
124 len -= 2; 123 len -= 2;
125 data += 2; 124 data += 2;
126 } while (len >= 2 && data[0] == reg && 125 } while (len >= 2 && data[0] == reg &&
127 msg.len < 32); 126 block_len < 32);
128 if ((ret = i2c_transfer(client->adapter, 127 if ((ret = i2c_master_send(client, block_data,
129 &msg, 1)) < 0) 128 block_len)) < 0)
130 break; 129 break;
131 } 130 }
132 } else { 131 } else {
@@ -209,6 +208,7 @@ saa7111_command (struct i2c_client *client,
209 switch (cmd) { 208 switch (cmd) {
210 209
211 case 0: 210 case 0:
211 break;
212 case DECODER_INIT: 212 case DECODER_INIT:
213 { 213 {
214 struct video_decoder_init *init = arg; 214 struct video_decoder_init *init = arg;
@@ -226,11 +226,11 @@ saa7111_command (struct i2c_client *client,
226 { 226 {
227 int i; 227 int i;
228 228
229 for (i = 0; i < 32; i += 16) { 229 for (i = 0; i < SAA7111_NR_REG; i += 16) {
230 int j; 230 int j;
231 231
232 printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); 232 printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i);
233 for (j = 0; j < 16; ++j) { 233 for (j = 0; j < 16 && i + j < SAA7111_NR_REG; ++j) {
234 printk(" %02x", 234 printk(" %02x",
235 saa7111_read(client, i + j)); 235 saa7111_read(client, i + j));
236 } 236 }