aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-i2c.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-08-15 13:41:57 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:05:16 -0400
commit6a59d64c5cc302e0139ddb1f5e57afceecb14368 (patch)
treee3a14e27b5aca04a4069797893d59df7bc0f8f65 /drivers/media/video/cx88/cx88-i2c.c
parentb09a79f5848f2143a8ffc724910743027d5a70e0 (diff)
V4L/DVB (6021): cx88: Copy board information into card state
The cx88 driver state stored the ID of the board type in core->board. Every time the driver need to get some information about the board configuration, it uses the board number as an index into board configuration array. This patch changes it so that the board number is in core->boardnr, and core->board is a copy of the board configuration information. This allows access to board information without the extra indirection. e.g. cx88_boards[core->board].mpeg becomes core->board.mpeg. This has a number of advantages: - The code is simpler to write. - It compiles to be smaller and faster, without needing the extra array lookup to get at the board information. - The cx88_boards array no longer needs to be exported to all cx88 modules. - The boards array can be made const - It should be possible to avoid keeping the (large) cx88_boards array around after the module is loaded. - If module parameters or eeprom info override some board configuration setting, it's not necessary to modify the boards array, which would affect all boards of the same type. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-i2c.c')
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 78bbcfab9670..6b42dea860fd 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -108,28 +108,28 @@ static int attach_inform(struct i2c_client *client)
108 if (!client->driver->command) 108 if (!client->driver->command)
109 return 0; 109 return 0;
110 110
111 if (core->radio_type != UNSET) { 111 if (core->board.radio_type != UNSET) {
112 if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) { 112 if ((core->board.radio_addr==ADDR_UNSET)||(core->board.radio_addr==client->addr)) {
113 tun_setup.mode_mask = T_RADIO; 113 tun_setup.mode_mask = T_RADIO;
114 tun_setup.type = core->radio_type; 114 tun_setup.type = core->board.radio_type;
115 tun_setup.addr = core->radio_addr; 115 tun_setup.addr = core->board.radio_addr;
116 116
117 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup); 117 client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
118 } 118 }
119 } 119 }
120 if (core->tuner_type != UNSET) { 120 if (core->board.tuner_type != UNSET) {
121 if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) { 121 if ((core->board.tuner_addr==ADDR_UNSET)||(core->board.tuner_addr==client->addr)) {
122 122
123 tun_setup.mode_mask = T_ANALOG_TV; 123 tun_setup.mode_mask = T_ANALOG_TV;
124 tun_setup.type = core->tuner_type; 124 tun_setup.type = core->board.tuner_type;
125 tun_setup.addr = core->tuner_addr; 125 tun_setup.addr = core->board.tuner_addr;
126 126
127 client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); 127 client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup);
128 } 128 }
129 } 129 }
130 130
131 if (core->tda9887_conf) 131 if (core->board.tda9887_conf)
132 client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); 132 client->driver->command(client, TDA9887_SET_CONFIG, &core->board.tda9887_conf);
133 return 0; 133 return 0;
134} 134}
135 135
@@ -204,9 +204,9 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
204 memcpy(&core->i2c_algo, &cx8800_i2c_algo_template, 204 memcpy(&core->i2c_algo, &cx8800_i2c_algo_template,
205 sizeof(core->i2c_algo)); 205 sizeof(core->i2c_algo));
206 206
207 if (core->tuner_type != TUNER_ABSENT) 207 if (core->board.tuner_type != TUNER_ABSENT)
208 core->i2c_adap.class |= I2C_CLASS_TV_ANALOG; 208 core->i2c_adap.class |= I2C_CLASS_TV_ANALOG;
209 if (cx88_boards[core->board].mpeg & CX88_MPEG_DVB) 209 if (core->board.mpeg & CX88_MPEG_DVB)
210 core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL; 210 core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
211 211
212 core->i2c_adap.dev.parent = &pci->dev; 212 core->i2c_adap.dev.parent = &pci->dev;