diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-07 05:02:27 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:41 -0400 |
commit | 8ac05ae3192ce8a71fc84e4a88772cce0c09173c (patch) | |
tree | 997f2d8bbedf857b33bf62d44b9cc4cd8c7a9f73 /drivers/media/video/ivtv/ivtv-driver.c | |
parent | d7493e518fa98d2c30c545c518df075903bae513 (diff) |
V4L/DVB (10488): ivtv: cleanup naming conventions
Use consistent naming for pci_dev, v4l2_device and video_device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-driver.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 93 |
1 files changed, 46 insertions, 47 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index c46c990987f9..eca8bf92a225 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -357,7 +357,7 @@ void ivtv_read_eeprom(struct ivtv *itv, struct tveeprom *tv) | |||
357 | static void ivtv_process_eeprom(struct ivtv *itv) | 357 | static void ivtv_process_eeprom(struct ivtv *itv) |
358 | { | 358 | { |
359 | struct tveeprom tv; | 359 | struct tveeprom tv; |
360 | int pci_slot = PCI_SLOT(itv->dev->devfn); | 360 | int pci_slot = PCI_SLOT(itv->pdev->devfn); |
361 | 361 | ||
362 | ivtv_read_eeprom(itv, &tv); | 362 | ivtv_read_eeprom(itv, &tv); |
363 | 363 | ||
@@ -604,7 +604,7 @@ static void ivtv_process_options(struct ivtv *itv) | |||
604 | itv->std = ivtv_parse_std(itv); | 604 | itv->std = ivtv_parse_std(itv); |
605 | if (itv->std == 0 && tunertype >= 0) | 605 | if (itv->std == 0 && tunertype >= 0) |
606 | itv->std = tunertype ? V4L2_STD_MN : (V4L2_STD_ALL & ~V4L2_STD_MN); | 606 | itv->std = tunertype ? V4L2_STD_MN : (V4L2_STD_ALL & ~V4L2_STD_MN); |
607 | itv->has_cx23415 = (itv->dev->device == PCI_DEVICE_ID_IVTV15); | 607 | itv->has_cx23415 = (itv->pdev->device == PCI_DEVICE_ID_IVTV15); |
608 | chipname = itv->has_cx23415 ? "cx23415" : "cx23416"; | 608 | chipname = itv->has_cx23415 ? "cx23415" : "cx23416"; |
609 | if (itv->options.cardtype == -1) { | 609 | if (itv->options.cardtype == -1) { |
610 | IVTV_INFO("Ignore card (detected %s based chip)\n", chipname); | 610 | IVTV_INFO("Ignore card (detected %s based chip)\n", chipname); |
@@ -617,9 +617,9 @@ static void ivtv_process_options(struct ivtv *itv) | |||
617 | IVTV_ERR("Unknown user specified type, trying to autodetect card\n"); | 617 | IVTV_ERR("Unknown user specified type, trying to autodetect card\n"); |
618 | } | 618 | } |
619 | if (itv->card == NULL) { | 619 | if (itv->card == NULL) { |
620 | if (itv->dev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE || | 620 | if (itv->pdev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE || |
621 | itv->dev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE_ALT1 || | 621 | itv->pdev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE_ALT1 || |
622 | itv->dev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE_ALT2) { | 622 | itv->pdev->subsystem_vendor == IVTV_PCI_ID_HAUPPAUGE_ALT2) { |
623 | itv->card = ivtv_get_card(itv->has_cx23415 ? IVTV_CARD_PVR_350 : IVTV_CARD_PVR_150); | 623 | itv->card = ivtv_get_card(itv->has_cx23415 ? IVTV_CARD_PVR_350 : IVTV_CARD_PVR_150); |
624 | IVTV_INFO("Autodetected Hauppauge card (%s based)\n", | 624 | IVTV_INFO("Autodetected Hauppauge card (%s based)\n", |
625 | chipname); | 625 | chipname); |
@@ -630,13 +630,13 @@ static void ivtv_process_options(struct ivtv *itv) | |||
630 | if (itv->card->pci_list == NULL) | 630 | if (itv->card->pci_list == NULL) |
631 | continue; | 631 | continue; |
632 | for (j = 0; itv->card->pci_list[j].device; j++) { | 632 | for (j = 0; itv->card->pci_list[j].device; j++) { |
633 | if (itv->dev->device != | 633 | if (itv->pdev->device != |
634 | itv->card->pci_list[j].device) | 634 | itv->card->pci_list[j].device) |
635 | continue; | 635 | continue; |
636 | if (itv->dev->subsystem_vendor != | 636 | if (itv->pdev->subsystem_vendor != |
637 | itv->card->pci_list[j].subsystem_vendor) | 637 | itv->card->pci_list[j].subsystem_vendor) |
638 | continue; | 638 | continue; |
639 | if (itv->dev->subsystem_device != | 639 | if (itv->pdev->subsystem_device != |
640 | itv->card->pci_list[j].subsystem_device) | 640 | itv->card->pci_list[j].subsystem_device) |
641 | continue; | 641 | continue; |
642 | IVTV_INFO("Autodetected %s card (%s based)\n", | 642 | IVTV_INFO("Autodetected %s card (%s based)\n", |
@@ -650,9 +650,9 @@ done: | |||
650 | if (itv->card == NULL) { | 650 | if (itv->card == NULL) { |
651 | itv->card = ivtv_get_card(IVTV_CARD_PVR_150); | 651 | itv->card = ivtv_get_card(IVTV_CARD_PVR_150); |
652 | IVTV_ERR("Unknown card: vendor/device: [%04x:%04x]\n", | 652 | IVTV_ERR("Unknown card: vendor/device: [%04x:%04x]\n", |
653 | itv->dev->vendor, itv->dev->device); | 653 | itv->pdev->vendor, itv->pdev->device); |
654 | IVTV_ERR(" subsystem vendor/device: [%04x:%04x]\n", | 654 | IVTV_ERR(" subsystem vendor/device: [%04x:%04x]\n", |
655 | itv->dev->subsystem_vendor, itv->dev->subsystem_device); | 655 | itv->pdev->subsystem_vendor, itv->pdev->subsystem_device); |
656 | IVTV_ERR(" %s based\n", chipname); | 656 | IVTV_ERR(" %s based\n", chipname); |
657 | IVTV_ERR("Defaulting to %s card\n", itv->card->name); | 657 | IVTV_ERR("Defaulting to %s card\n", itv->card->name); |
658 | IVTV_ERR("Please mail the vendor/device and subsystem vendor/device IDs and what kind of\n"); | 658 | IVTV_ERR("Please mail the vendor/device and subsystem vendor/device IDs and what kind of\n"); |
@@ -671,7 +671,7 @@ done: | |||
671 | */ | 671 | */ |
672 | static int __devinit ivtv_init_struct1(struct ivtv *itv) | 672 | static int __devinit ivtv_init_struct1(struct ivtv *itv) |
673 | { | 673 | { |
674 | itv->base_addr = pci_resource_start(itv->dev, 0); | 674 | itv->base_addr = pci_resource_start(itv->pdev, 0); |
675 | itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */ | 675 | itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */ |
676 | itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */ | 676 | itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */ |
677 | 677 | ||
@@ -682,7 +682,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
682 | spin_lock_init(&itv->lock); | 682 | spin_lock_init(&itv->lock); |
683 | spin_lock_init(&itv->dma_reg_lock); | 683 | spin_lock_init(&itv->dma_reg_lock); |
684 | 684 | ||
685 | itv->irq_work_queues = create_singlethread_workqueue(itv->device.name); | 685 | itv->irq_work_queues = create_singlethread_workqueue(itv->v4l2_dev.name); |
686 | if (itv->irq_work_queues == NULL) { | 686 | if (itv->irq_work_queues == NULL) { |
687 | IVTV_ERR("Could not create ivtv workqueue\n"); | 687 | IVTV_ERR("Could not create ivtv workqueue\n"); |
688 | return -1; | 688 | return -1; |
@@ -766,7 +766,7 @@ static void __devinit ivtv_init_struct2(struct ivtv *itv) | |||
766 | itv->audio_input = itv->card->video_inputs[i].audio_index; | 766 | itv->audio_input = itv->card->video_inputs[i].audio_index; |
767 | } | 767 | } |
768 | 768 | ||
769 | static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *dev, | 769 | static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev, |
770 | const struct pci_device_id *pci_id) | 770 | const struct pci_device_id *pci_id) |
771 | { | 771 | { |
772 | u16 cmd; | 772 | u16 cmd; |
@@ -775,11 +775,11 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *dev, | |||
775 | 775 | ||
776 | IVTV_DEBUG_INFO("Enabling pci device\n"); | 776 | IVTV_DEBUG_INFO("Enabling pci device\n"); |
777 | 777 | ||
778 | if (pci_enable_device(dev)) { | 778 | if (pci_enable_device(pdev)) { |
779 | IVTV_ERR("Can't enable device!\n"); | 779 | IVTV_ERR("Can't enable device!\n"); |
780 | return -EIO; | 780 | return -EIO; |
781 | } | 781 | } |
782 | if (pci_set_dma_mask(dev, 0xffffffff)) { | 782 | if (pci_set_dma_mask(pdev, 0xffffffff)) { |
783 | IVTV_ERR("No suitable DMA available.\n"); | 783 | IVTV_ERR("No suitable DMA available.\n"); |
784 | return -EIO; | 784 | return -EIO; |
785 | } | 785 | } |
@@ -805,11 +805,11 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *dev, | |||
805 | } | 805 | } |
806 | 806 | ||
807 | /* Check for bus mastering */ | 807 | /* Check for bus mastering */ |
808 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 808 | pci_read_config_word(pdev, PCI_COMMAND, &cmd); |
809 | if (!(cmd & PCI_COMMAND_MASTER)) { | 809 | if (!(cmd & PCI_COMMAND_MASTER)) { |
810 | IVTV_DEBUG_INFO("Attempting to enable Bus Mastering\n"); | 810 | IVTV_DEBUG_INFO("Attempting to enable Bus Mastering\n"); |
811 | pci_set_master(dev); | 811 | pci_set_master(pdev); |
812 | pci_read_config_word(dev, PCI_COMMAND, &cmd); | 812 | pci_read_config_word(pdev, PCI_COMMAND, &cmd); |
813 | if (!(cmd & PCI_COMMAND_MASTER)) { | 813 | if (!(cmd & PCI_COMMAND_MASTER)) { |
814 | IVTV_ERR("Bus Mastering is not enabled\n"); | 814 | IVTV_ERR("Bus Mastering is not enabled\n"); |
815 | return -ENXIO; | 815 | return -ENXIO; |
@@ -817,26 +817,26 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *dev, | |||
817 | } | 817 | } |
818 | IVTV_DEBUG_INFO("Bus Mastering Enabled.\n"); | 818 | IVTV_DEBUG_INFO("Bus Mastering Enabled.\n"); |
819 | 819 | ||
820 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &card_rev); | 820 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &card_rev); |
821 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); | 821 | pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &pci_latency); |
822 | 822 | ||
823 | if (pci_latency < 64 && ivtv_pci_latency) { | 823 | if (pci_latency < 64 && ivtv_pci_latency) { |
824 | IVTV_INFO("Unreasonably low latency timer, " | 824 | IVTV_INFO("Unreasonably low latency timer, " |
825 | "setting to 64 (was %d)\n", pci_latency); | 825 | "setting to 64 (was %d)\n", pci_latency); |
826 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); | 826 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); |
827 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &pci_latency); | 827 | pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &pci_latency); |
828 | } | 828 | } |
829 | /* This config space value relates to DMA latencies. The | 829 | /* This config space value relates to DMA latencies. The |
830 | default value 0x8080 is too low however and will lead | 830 | default value 0x8080 is too low however and will lead |
831 | to DMA errors. 0xffff is the max value which solves | 831 | to DMA errors. 0xffff is the max value which solves |
832 | these problems. */ | 832 | these problems. */ |
833 | pci_write_config_dword(dev, 0x40, 0xffff); | 833 | pci_write_config_dword(pdev, 0x40, 0xffff); |
834 | 834 | ||
835 | IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, " | 835 | IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, " |
836 | "irq: %d, latency: %d, memory: 0x%lx\n", | 836 | "irq: %d, latency: %d, memory: 0x%lx\n", |
837 | itv->dev->device, card_rev, dev->bus->number, | 837 | pdev->device, card_rev, pdev->bus->number, |
838 | PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), | 838 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), |
839 | itv->dev->irq, pci_latency, (unsigned long)itv->base_addr); | 839 | pdev->irq, pci_latency, (unsigned long)itv->base_addr); |
840 | 840 | ||
841 | return 0; | 841 | return 0; |
842 | } | 842 | } |
@@ -935,7 +935,7 @@ static void ivtv_load_and_init_modules(struct ivtv *itv) | |||
935 | } | 935 | } |
936 | } | 936 | } |
937 | 937 | ||
938 | static int __devinit ivtv_probe(struct pci_dev *dev, | 938 | static int __devinit ivtv_probe(struct pci_dev *pdev, |
939 | const struct pci_device_id *pci_id) | 939 | const struct pci_device_id *pci_id) |
940 | { | 940 | { |
941 | int retval = 0; | 941 | int retval = 0; |
@@ -945,17 +945,17 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
945 | itv = kzalloc(sizeof(struct ivtv), GFP_ATOMIC); | 945 | itv = kzalloc(sizeof(struct ivtv), GFP_ATOMIC); |
946 | if (itv == NULL) | 946 | if (itv == NULL) |
947 | return -ENOMEM; | 947 | return -ENOMEM; |
948 | itv->dev = dev; | 948 | itv->pdev = pdev; |
949 | itv->instance = atomic_inc_return(&ivtv_instance) - 1; | 949 | itv->instance = atomic_inc_return(&ivtv_instance) - 1; |
950 | 950 | ||
951 | retval = v4l2_device_register(&dev->dev, &itv->device); | 951 | retval = v4l2_device_register(&pdev->dev, &itv->v4l2_dev); |
952 | if (retval) { | 952 | if (retval) { |
953 | kfree(itv); | 953 | kfree(itv); |
954 | return retval; | 954 | return retval; |
955 | } | 955 | } |
956 | /* "ivtv + PCI ID" is a bit of a mouthful, so use | 956 | /* "ivtv + PCI ID" is a bit of a mouthful, so use |
957 | "ivtv + instance" instead. */ | 957 | "ivtv + instance" instead. */ |
958 | snprintf(itv->device.name, sizeof(itv->device.name), | 958 | snprintf(itv->v4l2_dev.name, sizeof(itv->v4l2_dev.name), |
959 | "ivtv%d", itv->instance); | 959 | "ivtv%d", itv->instance); |
960 | IVTV_INFO("Initializing card %d\n", itv->instance); | 960 | IVTV_INFO("Initializing card %d\n", itv->instance); |
961 | 961 | ||
@@ -972,12 +972,11 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
972 | IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); | 972 | IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); |
973 | 973 | ||
974 | /* PCI Device Setup */ | 974 | /* PCI Device Setup */ |
975 | if ((retval = ivtv_setup_pci(itv, dev, pci_id)) != 0) { | 975 | retval = ivtv_setup_pci(itv, pdev, pci_id); |
976 | if (retval == -EIO) | 976 | if (retval == -EIO) |
977 | goto free_workqueue; | 977 | goto free_workqueue; |
978 | else if (retval == -ENXIO) | 978 | if (retval == -ENXIO) |
979 | goto free_mem; | 979 | goto free_mem; |
980 | } | ||
981 | 980 | ||
982 | /* map io memory */ | 981 | /* map io memory */ |
983 | IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", | 982 | IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", |
@@ -1154,8 +1153,8 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1154 | ivtv_set_irq_mask(itv, 0xffffffff); | 1153 | ivtv_set_irq_mask(itv, 0xffffffff); |
1155 | 1154 | ||
1156 | /* Register IRQ */ | 1155 | /* Register IRQ */ |
1157 | retval = request_irq(itv->dev->irq, ivtv_irq_handler, | 1156 | retval = request_irq(itv->pdev->irq, ivtv_irq_handler, |
1158 | IRQF_SHARED | IRQF_DISABLED, itv->device.name, (void *)itv); | 1157 | IRQF_SHARED | IRQF_DISABLED, itv->v4l2_dev.name, (void *)itv); |
1159 | if (retval) { | 1158 | if (retval) { |
1160 | IVTV_ERR("Failed to register irq %d\n", retval); | 1159 | IVTV_ERR("Failed to register irq %d\n", retval); |
1161 | goto free_i2c; | 1160 | goto free_i2c; |
@@ -1177,7 +1176,7 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1177 | free_streams: | 1176 | free_streams: |
1178 | ivtv_streams_cleanup(itv, 1); | 1177 | ivtv_streams_cleanup(itv, 1); |
1179 | free_irq: | 1178 | free_irq: |
1180 | free_irq(itv->dev->irq, (void *)itv); | 1179 | free_irq(itv->pdev->irq, (void *)itv); |
1181 | free_i2c: | 1180 | free_i2c: |
1182 | exit_ivtv_i2c(itv); | 1181 | exit_ivtv_i2c(itv); |
1183 | free_io: | 1182 | free_io: |
@@ -1194,7 +1193,7 @@ err: | |||
1194 | retval = -ENODEV; | 1193 | retval = -ENODEV; |
1195 | IVTV_ERR("Error %d on initialization\n", retval); | 1194 | IVTV_ERR("Error %d on initialization\n", retval); |
1196 | 1195 | ||
1197 | v4l2_device_unregister(&itv->device); | 1196 | v4l2_device_unregister(&itv->v4l2_dev); |
1198 | kfree(itv); | 1197 | kfree(itv); |
1199 | return retval; | 1198 | return retval; |
1200 | } | 1199 | } |
@@ -1292,10 +1291,10 @@ int ivtv_init_on_first_open(struct ivtv *itv) | |||
1292 | return 0; | 1291 | return 0; |
1293 | } | 1292 | } |
1294 | 1293 | ||
1295 | static void ivtv_remove(struct pci_dev *pci_dev) | 1294 | static void ivtv_remove(struct pci_dev *pdev) |
1296 | { | 1295 | { |
1297 | struct v4l2_device *dev = dev_get_drvdata(&pci_dev->dev); | 1296 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); |
1298 | struct ivtv *itv = to_ivtv(dev); | 1297 | struct ivtv *itv = to_ivtv(v4l2_dev); |
1299 | int i; | 1298 | int i; |
1300 | 1299 | ||
1301 | IVTV_DEBUG_INFO("Removing card\n"); | 1300 | IVTV_DEBUG_INFO("Removing card\n"); |
@@ -1336,11 +1335,9 @@ static void ivtv_remove(struct pci_dev *pci_dev) | |||
1336 | ivtv_streams_cleanup(itv, 1); | 1335 | ivtv_streams_cleanup(itv, 1); |
1337 | ivtv_udma_free(itv); | 1336 | ivtv_udma_free(itv); |
1338 | 1337 | ||
1339 | v4l2_device_unregister(&itv->device); | ||
1340 | |||
1341 | exit_ivtv_i2c(itv); | 1338 | exit_ivtv_i2c(itv); |
1342 | 1339 | ||
1343 | free_irq(itv->dev->irq, (void *)itv); | 1340 | free_irq(itv->pdev->irq, (void *)itv); |
1344 | ivtv_iounmap(itv); | 1341 | ivtv_iounmap(itv); |
1345 | 1342 | ||
1346 | release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); | 1343 | release_mem_region(itv->base_addr, IVTV_ENCODER_SIZE); |
@@ -1348,11 +1345,13 @@ static void ivtv_remove(struct pci_dev *pci_dev) | |||
1348 | if (itv->has_cx23415) | 1345 | if (itv->has_cx23415) |
1349 | release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); | 1346 | release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); |
1350 | 1347 | ||
1351 | pci_disable_device(itv->dev); | 1348 | pci_disable_device(itv->pdev); |
1352 | for (i = 0; i < IVTV_VBI_FRAMES; i++) | 1349 | for (i = 0; i < IVTV_VBI_FRAMES; i++) |
1353 | kfree(itv->vbi.sliced_mpeg_data[i]); | 1350 | kfree(itv->vbi.sliced_mpeg_data[i]); |
1354 | 1351 | ||
1355 | printk(KERN_INFO "ivtv: Removed %s\n", itv->card_name); | 1352 | printk(KERN_INFO "ivtv: Removed %s\n", itv->card_name); |
1353 | |||
1354 | v4l2_device_unregister(&itv->v4l2_dev); | ||
1356 | kfree(itv); | 1355 | kfree(itv); |
1357 | } | 1356 | } |
1358 | 1357 | ||