aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-mpeg.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-mpeg.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-mpeg.c')
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c22
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)
55{ 55{
56 struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk); 56 struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk);
57 57
58 if (cx88_boards[dev->core->board].mpeg & CX88_MPEG_DVB) 58 if (dev->core->board.mpeg & CX88_MPEG_DVB)
59 request_module("cx88-dvb"); 59 request_module("cx88-dvb");
60 if (cx88_boards[dev->core->board].mpeg & CX88_MPEG_BLACKBIRD) 60 if (dev->core->board.mpeg & CX88_MPEG_BLACKBIRD)
61 request_module("cx88-blackbird"); 61 request_module("cx88-blackbird");
62} 62}
63 63
@@ -95,7 +95,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
95 dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id); 95 dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id);
96 96
97 if ( (core->active_type_id == CX88_MPEG_DVB) && 97 if ( (core->active_type_id == CX88_MPEG_DVB) &&
98 (cx88_boards[core->board].mpeg & CX88_MPEG_DVB) ) { 98 (core->board.mpeg & CX88_MPEG_DVB) ) {
99 99
100 dprintk( 1, "cx8802_start_dma doing .dvb\n"); 100 dprintk( 1, "cx8802_start_dma doing .dvb\n");
101 /* negedge driven & software reset */ 101 /* negedge driven & software reset */
@@ -103,7 +103,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
103 udelay(100); 103 udelay(100);
104 cx_write(MO_PINMUX_IO, 0x00); 104 cx_write(MO_PINMUX_IO, 0x00);
105 cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01); 105 cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01);
106 switch (core->board) { 106 switch (core->boardnr) {
107 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 107 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
108 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T: 108 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
109 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: 109 case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
@@ -124,7 +124,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
124 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); 124 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
125 udelay(100); 125 udelay(100);
126 } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) && 126 } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) &&
127 (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) ) { 127 (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) {
128 dprintk( 1, "cx8802_start_dma doing .blackbird\n"); 128 dprintk( 1, "cx8802_start_dma doing .blackbird\n");
129 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ 129 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
130 130
@@ -138,7 +138,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
138 udelay(100); 138 udelay(100);
139 } else { 139 } else {
140 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __FUNCTION__, 140 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __FUNCTION__,
141 cx88_boards[core->board].mpeg ); 141 core->board.mpeg );
142 return -EINVAL; 142 return -EINVAL;
143 } 143 }
144 144
@@ -689,8 +689,8 @@ int cx8802_register_driver(struct cx8802_driver *drv)
689 689
690 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n", 690 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n",
691 h->core->name,h->pci->subsystem_vendor, 691 h->core->name,h->pci->subsystem_vendor,
692 h->pci->subsystem_device,cx88_boards[h->core->board].name, 692 h->pci->subsystem_device,h->core->board.name,
693 h->core->board); 693 h->core->boardnr);
694 694
695 /* Bring up a new struct for each driver instance */ 695 /* Bring up a new struct for each driver instance */
696 driver = kzalloc(sizeof(*drv),GFP_KERNEL); 696 driver = kzalloc(sizeof(*drv),GFP_KERNEL);
@@ -741,8 +741,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
741 741
742 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n", 742 printk(KERN_INFO "CORE %s: subsystem: %04x:%04x, board: %s [card=%d]\n",
743 h->core->name,h->pci->subsystem_vendor, 743 h->core->name,h->pci->subsystem_vendor,
744 h->pci->subsystem_device,cx88_boards[h->core->board].name, 744 h->pci->subsystem_device,h->core->board.name,
745 h->core->board); 745 h->core->boardnr);
746 746
747 list_for_each_safe(list2, q, &h->drvlist.devlist) { 747 list_for_each_safe(list2, q, &h->drvlist.devlist) {
748 d = list_entry(list2, struct cx8802_driver, devlist); 748 d = list_entry(list2, struct cx8802_driver, devlist);
@@ -782,7 +782,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
782 printk("%s/2: cx2388x 8802 Driver Manager\n", core->name); 782 printk("%s/2: cx2388x 8802 Driver Manager\n", core->name);
783 783
784 err = -ENODEV; 784 err = -ENODEV;
785 if (!cx88_boards[core->board].mpeg) 785 if (!core->board.mpeg)
786 goto fail_core; 786 goto fail_core;
787 787
788 err = -ENOMEM; 788 err = -ENOMEM;