aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-blackbird.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-blackbird.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-blackbird.c')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index f2fcdb92ecce..74e3eb945751 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -734,14 +734,14 @@ static int vidioc_querycap (struct file *file, void *priv,
734 struct cx88_core *core = dev->core; 734 struct cx88_core *core = dev->core;
735 735
736 strcpy(cap->driver, "cx88_blackbird"); 736 strcpy(cap->driver, "cx88_blackbird");
737 strlcpy(cap->card, cx88_boards[core->board].name,sizeof(cap->card)); 737 strlcpy(cap->card, core->board.name, sizeof(cap->card));
738 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci)); 738 sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci));
739 cap->version = CX88_VERSION_CODE; 739 cap->version = CX88_VERSION_CODE;
740 cap->capabilities = 740 cap->capabilities =
741 V4L2_CAP_VIDEO_CAPTURE | 741 V4L2_CAP_VIDEO_CAPTURE |
742 V4L2_CAP_READWRITE | 742 V4L2_CAP_READWRITE |
743 V4L2_CAP_STREAMING; 743 V4L2_CAP_STREAMING;
744 if (UNSET != core->tuner_type) 744 if (UNSET != core->board.tuner_type)
745 cap->capabilities |= V4L2_CAP_TUNER; 745 cap->capabilities |= V4L2_CAP_TUNER;
746 return 0; 746 return 0;
747} 747}
@@ -990,7 +990,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
990 struct cx8802_fh *fh = priv; 990 struct cx8802_fh *fh = priv;
991 struct cx88_core *core = fh->dev->core; 991 struct cx88_core *core = fh->dev->core;
992 992
993 if (unlikely(UNSET == core->tuner_type)) 993 if (unlikely(UNSET == core->board.tuner_type))
994 return -EINVAL; 994 return -EINVAL;
995 995
996 f->type = V4L2_TUNER_ANALOG_TV; 996 f->type = V4L2_TUNER_ANALOG_TV;
@@ -1028,7 +1028,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
1028 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core; 1028 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core;
1029 u32 reg; 1029 u32 reg;
1030 1030
1031 if (unlikely(UNSET == core->tuner_type)) 1031 if (unlikely(UNSET == core->board.tuner_type))
1032 return -EINVAL; 1032 return -EINVAL;
1033 if (0 != t->index) 1033 if (0 != t->index)
1034 return -EINVAL; 1034 return -EINVAL;
@@ -1049,7 +1049,7 @@ static int vidioc_s_tuner (struct file *file, void *priv,
1049{ 1049{
1050 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core; 1050 struct cx88_core *core = ((struct cx8802_fh *)priv)->dev->core;
1051 1051
1052 if (UNSET == core->tuner_type) 1052 if (UNSET == core->board.tuner_type)
1053 return -EINVAL; 1053 return -EINVAL;
1054 if (0 != t->index) 1054 if (0 != t->index)
1055 return -EINVAL; 1055 return -EINVAL;
@@ -1246,7 +1246,7 @@ static int cx8802_blackbird_advise_acquire(struct cx8802_driver *drv)
1246 struct cx88_core *core = drv->core; 1246 struct cx88_core *core = drv->core;
1247 int err = 0; 1247 int err = 0;
1248 1248
1249 switch (core->board) { 1249 switch (core->boardnr) {
1250 case CX88_BOARD_HAUPPAUGE_HVR1300: 1250 case CX88_BOARD_HAUPPAUGE_HVR1300:
1251 /* By default, core setup will leave the cx22702 out of reset, on the bus. 1251 /* By default, core setup will leave the cx22702 out of reset, on the bus.
1252 * We left the hardware on power up with the cx22702 active. 1252 * We left the hardware on power up with the cx22702 active.
@@ -1268,7 +1268,7 @@ static int cx8802_blackbird_advise_release(struct cx8802_driver *drv)
1268 struct cx88_core *core = drv->core; 1268 struct cx88_core *core = drv->core;
1269 int err = 0; 1269 int err = 0;
1270 1270
1271 switch (core->board) { 1271 switch (core->boardnr) {
1272 case CX88_BOARD_HAUPPAUGE_HVR1300: 1272 case CX88_BOARD_HAUPPAUGE_HVR1300:
1273 /* Exit leaving the cx23416 on the bus */ 1273 /* Exit leaving the cx23416 on the bus */
1274 break; 1274 break;
@@ -1316,13 +1316,13 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
1316 1316
1317 dprintk( 1, "%s\n", __FUNCTION__); 1317 dprintk( 1, "%s\n", __FUNCTION__);
1318 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", 1318 dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
1319 core->board, 1319 core->boardnr,
1320 core->name, 1320 core->name,
1321 core->pci_bus, 1321 core->pci_bus,
1322 core->pci_slot); 1322 core->pci_slot);
1323 1323
1324 err = -ENODEV; 1324 err = -ENODEV;
1325 if (!(cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD)) 1325 if (!(core->board.mpeg & CX88_MPEG_BLACKBIRD))
1326 goto fail_core; 1326 goto fail_core;
1327 1327
1328 dev->width = 720; 1328 dev->width = 720;