diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-08-15 14:41:57 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 22:05:16 -0300 |
commit | 6a59d64c5cc302e0139ddb1f5e57afceecb14368 (patch) | |
tree | e3a14e27b5aca04a4069797893d59df7bc0f8f65 /drivers/media/video/cx88/cx88-mpeg.c | |
parent | b09a79f5848f2143a8ffc724910743027d5a70e0 (diff) | |
download | linux-6a59d64c5cc302e0139ddb1f5e57afceecb14368.tar.gz linux-6a59d64c5cc302e0139ddb1f5e57afceecb14368.tar.bz2 linux-6a59d64c5cc302e0139ddb1f5e57afceecb14368.zip |
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-mpeg.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-mpeg.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index c34158d9dcc1..1df245ace2d0 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -55,9 +55,9 @@ static void request_module_async(struct work_struct *work) { struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk); - if (cx88_boards[dev->core->board].mpeg & CX88_MPEG_DVB) + if (dev->core->board.mpeg & CX88_MPEG_DVB) request_module("cx88-dvb"); - if (cx88_boards[dev->core->board].mpeg & CX88_MPEG_BLACKBIRD) + if (dev->core->board.mpeg & CX88_MPEG_BLACKBIRD) request_module("cx88-blackbird"); } @@ -95,7 +95,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id); if ( (core->active_type_id == CX88_MPEG_DVB) && - (cx88_boards[core->board].mpeg & CX88_MPEG_DVB) ) { + (core->board.mpeg & CX88_MPEG_DVB) ) { dprintk( 1, "cx8802_start_dma doing .dvb\n"); /* negedge driven & software reset */ @@ -103,7 +103,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, udelay(100); cx_write(MO_PINMUX_IO, 0x00); cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); - switch (core->board) { + switch (core->boardnr) { case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: @@ -124,7 +124,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); udelay(100); } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) && - (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) ) { + (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) { dprintk( 1, "cx8802_start_dma doing .blackbird\n"); cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ @@ -138,7 +138,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, udelay(100); } else { printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __FUNCTION__, - cx88_boards[core->board].mpeg ); + core->board.mpeg ); return -EINVAL; } @@ -689,8 +689,8 @@ int cx8802_register_driver(struct cx8802_driver *drv) printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n", h->core->name,h->pci->subsystem_vendor, - h->pci->subsystem_device,cx88_boards[h->core->board].name, - h->core->board); + h->pci->subsystem_device,h->core->board.name, + h->core->boardnr); /* Bring up a new struct for each driver instance */ driver = kzalloc(sizeof(*drv),GFP_KERNEL); @@ -741,8 +741,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv) printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n", h->core->name,h->pci->subsystem_vendor, - h->pci->subsystem_device,cx88_boards[h->core->board].name, - h->core->board); + h->pci->subsystem_device,h->core->board.name, + h->core->boardnr); list_for_each_safe(list2, q, &h->drvlist.devlist) { d = list_entry(list2, struct cx8802_driver, devlist); @@ -782,7 +782,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev, printk("%s/2: cx2388x 8802 Driver Manager\n", core->name); err = -ENODEV; - if (!cx88_boards[core->board].mpeg) + if (!core->board.mpeg) goto fail_core; err = -ENOMEM; |