aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-01-10 19:54:39 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:25 -0400
commit3d05913d894a460b7dc8e5d93415fde21b986411 (patch)
tree04a2216afdbbf27230dd364107d5d1dcb7f13057 /drivers/media/video/cx18/cx18-driver.c
parente0f28b6a69b73ebf610f4f9759999bcdabdcda8e (diff)
V4L/DVB (10280): cx18: Rename structure members: dev to pci_dev and v4l2dev to video_dev
Renamed structure member name to be more specific to type in anticipation of updating to the v4l2_device/v4l2_subdev framework. Too many objects named "dev" and /v4l2_\{0,1\}dev/ would be to confusing. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.c')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index e161d29beb70..52d04f640b73 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -502,7 +502,7 @@ static void cx18_process_options(struct cx18 *cx)
502 else if (cx->options.cardtype != 0) 502 else if (cx->options.cardtype != 0)
503 CX18_ERR("Unknown user specified type, trying to autodetect card\n"); 503 CX18_ERR("Unknown user specified type, trying to autodetect card\n");
504 if (cx->card == NULL) { 504 if (cx->card == NULL) {
505 if (cx->dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) { 505 if (cx->pci_dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) {
506 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); 506 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
507 CX18_INFO("Autodetected Hauppauge card\n"); 507 CX18_INFO("Autodetected Hauppauge card\n");
508 } 508 }
@@ -512,13 +512,13 @@ static void cx18_process_options(struct cx18 *cx)
512 if (cx->card->pci_list == NULL) 512 if (cx->card->pci_list == NULL)
513 continue; 513 continue;
514 for (j = 0; cx->card->pci_list[j].device; j++) { 514 for (j = 0; cx->card->pci_list[j].device; j++) {
515 if (cx->dev->device != 515 if (cx->pci_dev->device !=
516 cx->card->pci_list[j].device) 516 cx->card->pci_list[j].device)
517 continue; 517 continue;
518 if (cx->dev->subsystem_vendor != 518 if (cx->pci_dev->subsystem_vendor !=
519 cx->card->pci_list[j].subsystem_vendor) 519 cx->card->pci_list[j].subsystem_vendor)
520 continue; 520 continue;
521 if (cx->dev->subsystem_device != 521 if (cx->pci_dev->subsystem_device !=
522 cx->card->pci_list[j].subsystem_device) 522 cx->card->pci_list[j].subsystem_device)
523 continue; 523 continue;
524 CX18_INFO("Autodetected %s card\n", cx->card->name); 524 CX18_INFO("Autodetected %s card\n", cx->card->name);
@@ -531,9 +531,10 @@ done:
531 if (cx->card == NULL) { 531 if (cx->card == NULL) {
532 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); 532 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
533 CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n", 533 CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n",
534 cx->dev->vendor, cx->dev->device); 534 cx->pci_dev->vendor, cx->pci_dev->device);
535 CX18_ERR(" subsystem vendor/device: [%04x:%04x]\n", 535 CX18_ERR(" subsystem vendor/device: [%04x:%04x]\n",
536 cx->dev->subsystem_vendor, cx->dev->subsystem_device); 536 cx->pci_dev->subsystem_vendor,
537 cx->pci_dev->subsystem_device);
537 CX18_ERR("Defaulting to %s card\n", cx->card->name); 538 CX18_ERR("Defaulting to %s card\n", cx->card->name);
538 CX18_ERR("Please mail the vendor/device and subsystem vendor/device IDs and what kind of\n"); 539 CX18_ERR("Please mail the vendor/device and subsystem vendor/device IDs and what kind of\n");
539 CX18_ERR("card you have to the ivtv-devel mailinglist (www.ivtvdriver.org)\n"); 540 CX18_ERR("card you have to the ivtv-devel mailinglist (www.ivtvdriver.org)\n");
@@ -553,7 +554,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
553{ 554{
554 int i; 555 int i;
555 556
556 cx->base_addr = pci_resource_start(cx->dev, 0); 557 cx->base_addr = pci_resource_start(cx->pci_dev, 0);
557 558
558 mutex_init(&cx->serialize_lock); 559 mutex_init(&cx->serialize_lock);
559 mutex_init(&cx->i2c_bus_lock[0]); 560 mutex_init(&cx->i2c_bus_lock[0]);
@@ -676,7 +677,7 @@ static void __devinit cx18_init_struct2(struct cx18 *cx)
676 cx->av_state.vbi_line_offset = 8; 677 cx->av_state.vbi_line_offset = 8;
677} 678}
678 679
679static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev, 680static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev,
680 const struct pci_device_id *pci_id) 681 const struct pci_device_id *pci_id)
681{ 682{
682 u16 cmd; 683 u16 cmd;
@@ -684,11 +685,11 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev,
684 685
685 CX18_DEBUG_INFO("Enabling pci device\n"); 686 CX18_DEBUG_INFO("Enabling pci device\n");
686 687
687 if (pci_enable_device(dev)) { 688 if (pci_enable_device(pci_dev)) {
688 CX18_ERR("Can't enable device %d!\n", cx->num); 689 CX18_ERR("Can't enable device %d!\n", cx->num);
689 return -EIO; 690 return -EIO;
690 } 691 }
691 if (pci_set_dma_mask(dev, 0xffffffff)) { 692 if (pci_set_dma_mask(pci_dev, 0xffffffff)) {
692 CX18_ERR("No suitable DMA available on card %d.\n", cx->num); 693 CX18_ERR("No suitable DMA available on card %d.\n", cx->num);
693 return -EIO; 694 return -EIO;
694 } 695 }
@@ -698,25 +699,25 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *dev,
698 } 699 }
699 700
700 /* Enable bus mastering and memory mapped IO for the CX23418 */ 701 /* Enable bus mastering and memory mapped IO for the CX23418 */
701 pci_read_config_word(dev, PCI_COMMAND, &cmd); 702 pci_read_config_word(pci_dev, PCI_COMMAND, &cmd);
702 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; 703 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
703 pci_write_config_word(dev, PCI_COMMAND, cmd); 704 pci_write_config_word(pci_dev, PCI_COMMAND, cmd);
704 705
705 pci_read_config_byte(dev, PCI_CLASS_REVISION, &cx->card_rev); 706 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &cx->card_rev);
706 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); 707 pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);
707 708
708 if (pci_latency < 64 && cx18_pci_latency) { 709 if (pci_latency < 64 && cx18_pci_latency) {
709 CX18_INFO("Unreasonably low latency timer, " 710 CX18_INFO("Unreasonably low latency timer, "
710 "setting to 64 (was %d)\n", pci_latency); 711 "setting to 64 (was %d)\n", pci_latency);
711 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); 712 pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, 64);
712 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); 713 pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &pci_latency);
713 } 714 }
714 715
715 CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, " 716 CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, "
716 "irq: %d, latency: %d, memory: 0x%lx\n", 717 "irq: %d, latency: %d, memory: 0x%lx\n",
717 cx->dev->device, cx->card_rev, dev->bus->number, 718 cx->pci_dev->device, cx->card_rev, pci_dev->bus->number,
718 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), 719 PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn),
719 cx->dev->irq, pci_latency, (unsigned long)cx->base_addr); 720 cx->pci_dev->irq, pci_latency, (unsigned long)cx->base_addr);
720 721
721 return 0; 722 return 0;
722} 723}
@@ -771,7 +772,7 @@ static void cx18_load_and_init_modules(struct cx18 *cx)
771 hw = cx->hw_flags; 772 hw = cx->hw_flags;
772} 773}
773 774
774static int __devinit cx18_probe(struct pci_dev *dev, 775static int __devinit cx18_probe(struct pci_dev *pci_dev,
775 const struct pci_device_id *pci_id) 776 const struct pci_device_id *pci_id)
776{ 777{
777 int retval = 0; 778 int retval = 0;
@@ -796,7 +797,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
796 return -ENOMEM; 797 return -ENOMEM;
797 } 798 }
798 cx18_cards[cx18_cards_active] = cx; 799 cx18_cards[cx18_cards_active] = cx;
799 cx->dev = dev; 800 cx->pci_dev = pci_dev;
800 cx->num = cx18_cards_active++; 801 cx->num = cx18_cards_active++;
801 snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num); 802 snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num);
802 CX18_INFO("Initializing card #%d\n", cx->num); 803 CX18_INFO("Initializing card #%d\n", cx->num);
@@ -816,12 +817,12 @@ static int __devinit cx18_probe(struct pci_dev *dev,
816 CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr); 817 CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr);
817 818
818 /* PCI Device Setup */ 819 /* PCI Device Setup */
819 retval = cx18_setup_pci(cx, dev, pci_id); 820 retval = cx18_setup_pci(cx, pci_dev, pci_id);
820 if (retval != 0) 821 if (retval != 0)
821 goto free_workqueue; 822 goto free_workqueue;
822 823
823 /* save cx in the pci struct for later use */ 824 /* save cx in the pci struct for later use */
824 pci_set_drvdata(dev, cx); 825 pci_set_drvdata(pci_dev, cx);
825 826
826 /* map io memory */ 827 /* map io memory */
827 CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", 828 CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n",
@@ -881,7 +882,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
881 cx18_init_scb(cx); 882 cx18_init_scb(cx);
882 883
883 /* Register IRQ */ 884 /* Register IRQ */
884 retval = request_irq(cx->dev->irq, cx18_irq_handler, 885 retval = request_irq(cx->pci_dev->irq, cx18_irq_handler,
885 IRQF_SHARED | IRQF_DISABLED, cx->name, (void *)cx); 886 IRQF_SHARED | IRQF_DISABLED, cx->name, (void *)cx);
886 if (retval) { 887 if (retval) {
887 CX18_ERR("Failed to register irq %d\n", retval); 888 CX18_ERR("Failed to register irq %d\n", retval);
@@ -992,7 +993,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
992free_streams: 993free_streams:
993 cx18_streams_cleanup(cx, 1); 994 cx18_streams_cleanup(cx, 1);
994free_irq: 995free_irq:
995 free_irq(cx->dev->irq, (void *)cx); 996 free_irq(cx->pci_dev->irq, (void *)cx);
996free_i2c: 997free_i2c:
997 exit_cx18_i2c(cx); 998 exit_cx18_i2c(cx);
998free_map: 999free_map:
@@ -1128,13 +1129,13 @@ static void cx18_remove(struct pci_dev *pci_dev)
1128 1129
1129 exit_cx18_i2c(cx); 1130 exit_cx18_i2c(cx);
1130 1131
1131 free_irq(cx->dev->irq, (void *)cx); 1132 free_irq(cx->pci_dev->irq, (void *)cx);
1132 1133
1133 cx18_iounmap(cx); 1134 cx18_iounmap(cx);
1134 1135
1135 release_mem_region(cx->base_addr, CX18_MEM_SIZE); 1136 release_mem_region(cx->base_addr, CX18_MEM_SIZE);
1136 1137
1137 pci_disable_device(cx->dev); 1138 pci_disable_device(cx->pci_dev);
1138 1139
1139 CX18_INFO("Removed %s, card #%d\n", cx->card_name, cx->num); 1140 CX18_INFO("Removed %s, card #%d\n", cx->card_name, cx->num);
1140} 1141}