diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-28 22:37:26 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-03-28 22:37:26 -0300 |
commit | 796a8651acd1759db5223b03bdbfe43f94d7c11e (patch) | |
tree | 9b3e1ab68d9b3ee312b53b59d32a02eef07ac462 /linux/drivers/media | |
parent | e60856749d426d17f349991659c4fbffbba5d833 (diff) | |
download | mediapointer-dvb-s2-796a8651acd1759db5223b03bdbfe43f94d7c11e.tar.gz mediapointer-dvb-s2-796a8651acd1759db5223b03bdbfe43f94d7c11e.tar.bz2 |
Use ARRAY_SIZE and a cleaner logic for initializing tuner
From: Mauro Carvalho Chehab <mchehab@infradead.org>
ATI HDTV Wonder needs to initialize some registers before allowing the
tuner to start working.
The current logic have lots of magic. This patch makes the code cleaner,
using ARRAY_SIZE() for the initialization array and using a
bidimensional array, instead of doing some stuff like:
&buffer[i+2][0]
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-cards.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index 774bcfed9..825334ef3 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1823,7 +1823,7 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core) { 0x03, 0x0C }, }; - for (i = 0; i < 13; i++) { + for (i = 0; i < ARRAY_SIZE(init_bufs); i++) { msg.buf = init_bufs[i]; msg.len = (i != 12 ? 5 : 2); err = i2c_transfer(&core->i2c_adap, &msg, 1); @@ -1950,12 +1950,21 @@ void cx88_card_setup(struct cx88_core *core) if (0 == core->i2c_rc) { /* enable tuner */ int i; - static const u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 }; + static const u8 buffer [][2] = { + {0x10,0x12}, + {0x13,0x04}, + {0x16,0x00}, + {0x14,0x04}, + {0x17,0x00} + }; core->i2c_client.addr = 0x0a; - for (i = 0; i < 5; i++) - if (2 != i2c_master_send(&core->i2c_client,&buffer[i*2],2)) - printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n", + for (i = 0; i < ARRAY_SIZE(buffer); i++) + if (2 != i2c_master_send(&core->i2c_client, + buffer[i],2)) + printk(KERN_WARNING + "%s: Unable to enable " + "tuner(%i).\n", core->name, i); } break; |