aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-input.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-input.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-input.c')
-rw-r--r--drivers/media/video/cx88/cx88-input.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index f5d4a565346e..120f56857f0e 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -74,7 +74,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
74 74
75 /* read gpio value */ 75 /* read gpio value */
76 gpio = cx_read(ir->gpio_addr); 76 gpio = cx_read(ir->gpio_addr);
77 switch (core->board) { 77 switch (core->boardnr) {
78 case CX88_BOARD_NPGTECH_REALTV_TOP10FM: 78 case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
79 /* This board apparently uses a combination of 2 GPIO 79 /* This board apparently uses a combination of 2 GPIO
80 to represent the keys. Additionally, the second GPIO 80 to represent the keys. Additionally, the second GPIO
@@ -113,7 +113,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
113 (gpio & ir->mask_keydown) ? " down" : "", 113 (gpio & ir->mask_keydown) ? " down" : "",
114 (gpio & ir->mask_keyup) ? " up" : ""); 114 (gpio & ir->mask_keyup) ? " up" : "");
115 115
116 if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) { 116 if (ir->core->boardnr == CX88_BOARD_NORWOOD_MICRO) {
117 u32 gpio_key = cx_read(MO_GP0_IO); 117 u32 gpio_key = cx_read(MO_GP0_IO);
118 118
119 data = (data << 4) | ((gpio_key & 0xf0) >> 4); 119 data = (data << 4) | ((gpio_key & 0xf0) >> 4);
@@ -204,7 +204,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
204 ir->input = input_dev; 204 ir->input = input_dev;
205 205
206 /* detect & configure */ 206 /* detect & configure */
207 switch (core->board) { 207 switch (core->boardnr) {
208 case CX88_BOARD_DNTV_LIVE_DVB_T: 208 case CX88_BOARD_DNTV_LIVE_DVB_T:
209 case CX88_BOARD_KWORLD_DVB_T: 209 case CX88_BOARD_KWORLD_DVB_T:
210 case CX88_BOARD_KWORLD_DVB_T_CX22702: 210 case CX88_BOARD_KWORLD_DVB_T_CX22702:
@@ -314,8 +314,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
314 } 314 }
315 315
316 /* init input device */ 316 /* init input device */
317 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", 317 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
318 cx88_boards[core->board].name);
319 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); 318 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
320 319
321 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); 320 ir_input_init(input_dev, &ir->ir, ir_type, ir_codes);
@@ -406,7 +405,7 @@ void cx88_ir_irq(struct cx88_core *core)
406 ir_dump_samples(ir->samples, ir->scount); 405 ir_dump_samples(ir->samples, ir->scount);
407 406
408 /* decode it */ 407 /* decode it */
409 switch (core->board) { 408 switch (core->boardnr) {
410 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 409 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
411 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: 410 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
412 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); 411 ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4);