aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-07 05:02:27 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:41 -0400
commit8ac05ae3192ce8a71fc84e4a88772cce0c09173c (patch)
tree997f2d8bbedf857b33bf62d44b9cc4cd8c7a9f73 /drivers
parentd7493e518fa98d2c30c545c518df075903bae513 (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')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c93
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h24
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-firmware.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-gpio.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c14
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c6
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-queue.c8
-rw-r--r--drivers/media/video/ivtv/ivtv-queue.h8
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c68
-rw-r--r--drivers/media/video/ivtv/ivtv-udma.c10
-rw-r--r--drivers/media/video/ivtv/ivtv-udma.h4
-rw-r--r--drivers/media/video/ivtv/ivtv-yuv.c6
-rw-r--r--drivers/media/video/ivtv/ivtvfb.c6
15 files changed, 129 insertions, 130 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index c46c990987f..eca8bf92a22 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)
357static void ivtv_process_eeprom(struct ivtv *itv) 357static 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 */
672static int __devinit ivtv_init_struct1(struct ivtv *itv) 672static 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
769static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *dev, 769static 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
938static int __devinit ivtv_probe(struct pci_dev *dev, 938static 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,
1177free_streams: 1176free_streams:
1178 ivtv_streams_cleanup(itv, 1); 1177 ivtv_streams_cleanup(itv, 1);
1179free_irq: 1178free_irq:
1180 free_irq(itv->dev->irq, (void *)itv); 1179 free_irq(itv->pdev->irq, (void *)itv);
1181free_i2c: 1180free_i2c:
1182 exit_ivtv_i2c(itv); 1181 exit_ivtv_i2c(itv);
1183free_io: 1182free_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
1295static void ivtv_remove(struct pci_dev *pci_dev) 1294static 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
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index 94f7f44d598..440f7328a7e 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -133,7 +133,7 @@ extern int ivtv_debug;
133#define IVTV_DEBUG(x, type, fmt, args...) \ 133#define IVTV_DEBUG(x, type, fmt, args...) \
134 do { \ 134 do { \
135 if ((x) & ivtv_debug) \ 135 if ((x) & ivtv_debug) \
136 v4l2_info(&itv->device, " " type ": " fmt , ##args); \ 136 v4l2_info(&itv->v4l2_dev, " " type ": " fmt , ##args); \
137 } while (0) 137 } while (0)
138#define IVTV_DEBUG_WARN(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_WARN, "warn", fmt , ## args) 138#define IVTV_DEBUG_WARN(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_WARN, "warn", fmt , ## args)
139#define IVTV_DEBUG_INFO(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_INFO, "info", fmt , ## args) 139#define IVTV_DEBUG_INFO(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_INFO, "info", fmt , ## args)
@@ -149,7 +149,7 @@ extern int ivtv_debug;
149#define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...) \ 149#define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...) \
150 do { \ 150 do { \
151 if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \ 151 if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \
152 v4l2_info(&itv->device, " " type ": " fmt , ##args); \ 152 v4l2_info(&itv->v4l2_dev, " " type ": " fmt , ##args); \
153 } while (0) 153 } while (0)
154#define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warn", fmt , ## args) 154#define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warn", fmt , ## args)
155#define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info", fmt , ## args) 155#define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info", fmt , ## args)
@@ -163,9 +163,9 @@ extern int ivtv_debug;
163#define IVTV_DEBUG_HI_YUV(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_YUV, "yuv", fmt , ## args) 163#define IVTV_DEBUG_HI_YUV(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_YUV, "yuv", fmt , ## args)
164 164
165/* Standard kernel messages */ 165/* Standard kernel messages */
166#define IVTV_ERR(fmt, args...) v4l2_err(&itv->device, fmt , ## args) 166#define IVTV_ERR(fmt, args...) v4l2_err(&itv->v4l2_dev, fmt , ## args)
167#define IVTV_WARN(fmt, args...) v4l2_warn(&itv->device, fmt , ## args) 167#define IVTV_WARN(fmt, args...) v4l2_warn(&itv->v4l2_dev, fmt , ## args)
168#define IVTV_INFO(fmt, args...) v4l2_info(&itv->device, fmt , ## args) 168#define IVTV_INFO(fmt, args...) v4l2_info(&itv->v4l2_dev, fmt , ## args)
169 169
170/* output modes (cx23415 only) */ 170/* output modes (cx23415 only) */
171#define OUT_NONE 0 171#define OUT_NONE 0
@@ -315,7 +315,7 @@ struct ivtv; /* forward reference */
315struct ivtv_stream { 315struct ivtv_stream {
316 /* These first four fields are always set, even if the stream 316 /* These first four fields are always set, even if the stream
317 is not actually created. */ 317 is not actually created. */
318 struct video_device *v4l2dev; /* NULL when stream not created */ 318 struct video_device *vdev; /* NULL when stream not created */
319 struct ivtv *itv; /* for ease of use */ 319 struct ivtv *itv; /* for ease of use */
320 const char *name; /* name of the stream */ 320 const char *name; /* name of the stream */
321 int type; /* stream type */ 321 int type; /* stream type */
@@ -592,7 +592,7 @@ struct ivtv_card;
592/* Struct to hold info about ivtv cards */ 592/* Struct to hold info about ivtv cards */
593struct ivtv { 593struct ivtv {
594 /* General fixed card data */ 594 /* General fixed card data */
595 struct pci_dev *dev; /* PCI device */ 595 struct pci_dev *pdev; /* PCI device */
596 const struct ivtv_card *card; /* card information */ 596 const struct ivtv_card *card; /* card information */
597 const char *card_name; /* full name of the card */ 597 const char *card_name; /* full name of the card */
598 const struct ivtv_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */ 598 const struct ivtv_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */
@@ -612,7 +612,7 @@ struct ivtv {
612 volatile void __iomem *reg_mem; /* pointer to mapped registers */ 612 volatile void __iomem *reg_mem; /* pointer to mapped registers */
613 struct ivtv_options options; /* user options */ 613 struct ivtv_options options; /* user options */
614 614
615 struct v4l2_device device; 615 struct v4l2_device v4l2_dev;
616 struct v4l2_subdev sd_gpio; /* GPIO sub-device */ 616 struct v4l2_subdev sd_gpio; /* GPIO sub-device */
617 u16 instance; 617 u16 instance;
618 618
@@ -719,9 +719,9 @@ struct ivtv {
719 struct osd_info *osd_info; /* ivtvfb private OSD info */ 719 struct osd_info *osd_info; /* ivtvfb private OSD info */
720}; 720};
721 721
722static inline struct ivtv *to_ivtv(struct v4l2_device *dev) 722static inline struct ivtv *to_ivtv(struct v4l2_device *v4l2_dev)
723{ 723{
724 return container_of(dev, struct ivtv, device); 724 return container_of(v4l2_dev, struct ivtv, v4l2_dev);
725} 725}
726 726
727/* Globals */ 727/* Globals */
@@ -788,7 +788,7 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv)
788/* Call the specified callback for all subdevs matching hw (if 0, then 788/* Call the specified callback for all subdevs matching hw (if 0, then
789 match them all). Ignore any errors. */ 789 match them all). Ignore any errors. */
790#define ivtv_call_hw(itv, hw, o, f, args...) \ 790#define ivtv_call_hw(itv, hw, o, f, args...) \
791 __v4l2_device_call_subdevs(&(itv)->device, !(hw) || (sd->grp_id & (hw)), o, f , ##args) 791 __v4l2_device_call_subdevs(&(itv)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args)
792 792
793#define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args) 793#define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args)
794 794
@@ -796,7 +796,7 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv)
796 match them all). If the callback returns an error other than 0 or 796 match them all). If the callback returns an error other than 0 or
797 -ENOIOCTLCMD, then return with that error code. */ 797 -ENOIOCTLCMD, then return with that error code. */
798#define ivtv_call_hw_err(itv, hw, o, f, args...) \ 798#define ivtv_call_hw_err(itv, hw, o, f, args...) \
799 __v4l2_device_call_subdevs_until_err(&(itv)->device, !(hw) || (sd->grp_id & (hw)), o, f , ##args) 799 __v4l2_device_call_subdevs_until_err(&(itv)->v4l2_dev, !(hw) || (sd->grp_id & (hw)), o, f , ##args)
800 800
801#define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args) 801#define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args)
802 802
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 617667d1ceb..cfaacf6096d 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -991,7 +991,7 @@ int ivtv_v4l2_open(struct file *filp)
991 mutex_lock(&itv->serialize_lock); 991 mutex_lock(&itv->serialize_lock);
992 if (ivtv_init_on_first_open(itv)) { 992 if (ivtv_init_on_first_open(itv)) {
993 IVTV_ERR("Failed to initialize on minor %d\n", 993 IVTV_ERR("Failed to initialize on minor %d\n",
994 s->v4l2dev->minor); 994 vdev->minor);
995 mutex_unlock(&itv->serialize_lock); 995 mutex_unlock(&itv->serialize_lock);
996 return -ENXIO; 996 return -ENXIO;
997 } 997 }
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c
index 6dba55b7e25..c1b7ec475c2 100644
--- a/drivers/media/video/ivtv/ivtv-firmware.c
+++ b/drivers/media/video/ivtv/ivtv-firmware.c
@@ -52,7 +52,7 @@ static int load_fw_direct(const char *fn, volatile u8 __iomem *mem, struct ivtv
52 int retries = 3; 52 int retries = 3;
53 53
54retry: 54retry:
55 if (retries && request_firmware(&fw, fn, &itv->dev->dev) == 0) { 55 if (retries && request_firmware(&fw, fn, &itv->pdev->dev) == 0) {
56 int i; 56 int i;
57 volatile u32 __iomem *dst = (volatile u32 __iomem *)mem; 57 volatile u32 __iomem *dst = (volatile u32 __iomem *)mem;
58 const u32 *src = (const u32 *)fw->data; 58 const u32 *src = (const u32 *)fw->data;
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c
index dc2850e87a7..3321983d89e 100644
--- a/drivers/media/video/ivtv/ivtv-gpio.c
+++ b/drivers/media/video/ivtv/ivtv-gpio.c
@@ -384,7 +384,7 @@ int ivtv_gpio_init(struct ivtv *itv)
384 write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT); 384 write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT);
385 write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR); 385 write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR);
386 v4l2_subdev_init(&itv->sd_gpio, &subdev_ops); 386 v4l2_subdev_init(&itv->sd_gpio, &subdev_ops);
387 snprintf(itv->sd_gpio.name, sizeof(itv->sd_gpio.name), "%s-gpio", itv->device.name); 387 snprintf(itv->sd_gpio.name, sizeof(itv->sd_gpio.name), "%s-gpio", itv->v4l2_dev.name);
388 itv->sd_gpio.grp_id = IVTV_HW_GPIO; 388 itv->sd_gpio.grp_id = IVTV_HW_GPIO;
389 return v4l2_device_register_subdev(&itv->device, &itv->sd_gpio); 389 return v4l2_device_register_subdev(&itv->v4l2_dev, &itv->sd_gpio);
390} 390}
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index ca1d9557945..e73a196ecc7 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -194,14 +194,14 @@ struct v4l2_subdev *ivtv_find_hw(struct ivtv *itv, u32 hw)
194 struct v4l2_subdev *result = NULL; 194 struct v4l2_subdev *result = NULL;
195 struct v4l2_subdev *sd; 195 struct v4l2_subdev *sd;
196 196
197 spin_lock(&itv->device.lock); 197 spin_lock(&itv->v4l2_dev.lock);
198 v4l2_device_for_each_subdev(sd, &itv->device) { 198 v4l2_device_for_each_subdev(sd, &itv->v4l2_dev) {
199 if (sd->grp_id == hw) { 199 if (sd->grp_id == hw) {
200 result = sd; 200 result = sd;
201 break; 201 break;
202 } 202 }
203 } 203 }
204 spin_unlock(&itv->device.lock); 204 spin_unlock(&itv->v4l2_dev.lock);
205 return result; 205 return result;
206} 206}
207 207
@@ -472,8 +472,8 @@ static int ivtv_read(struct ivtv *itv, unsigned char addr, unsigned char *data,
472 intervening stop condition */ 472 intervening stop condition */
473static int ivtv_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) 473static int ivtv_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
474{ 474{
475 struct v4l2_device *drv = i2c_get_adapdata(i2c_adap); 475 struct v4l2_device *v4l2_dev = i2c_get_adapdata(i2c_adap);
476 struct ivtv *itv = to_ivtv(drv); 476 struct ivtv *itv = to_ivtv(v4l2_dev);
477 int retval; 477 int retval;
478 int i; 478 int i;
479 479
@@ -604,12 +604,12 @@ int init_ivtv_i2c(struct ivtv *itv)
604 604
605 sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d", 605 sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d",
606 itv->instance); 606 itv->instance);
607 i2c_set_adapdata(&itv->i2c_adap, &itv->device); 607 i2c_set_adapdata(&itv->i2c_adap, &itv->v4l2_dev);
608 608
609 memcpy(&itv->i2c_client, &ivtv_i2c_client_template, 609 memcpy(&itv->i2c_client, &ivtv_i2c_client_template,
610 sizeof(struct i2c_client)); 610 sizeof(struct i2c_client));
611 itv->i2c_client.adapter = &itv->i2c_adap; 611 itv->i2c_client.adapter = &itv->i2c_adap;
612 itv->i2c_adap.dev.parent = &itv->dev->dev; 612 itv->i2c_adap.dev.parent = &itv->pdev->dev;
613 613
614 IVTV_DEBUG_I2C("setting scl and sda to 1\n"); 614 IVTV_DEBUG_I2C("setting scl and sda to 1\n");
615 ivtv_setscl(itv, 1); 615 ivtv_setscl(itv, 1);
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index e8621da26d8..9a0424298af 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -770,7 +770,7 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc
770 770
771 strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); 771 strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
772 strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); 772 strlcpy(vcap->card, itv->card_name, sizeof(vcap->card));
773 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->dev)); 773 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev));
774 vcap->version = IVTV_DRIVER_VERSION; /* version */ 774 vcap->version = IVTV_DRIVER_VERSION; /* version */
775 vcap->capabilities = itv->v4l2_cap; /* capabilities */ 775 vcap->capabilities = itv->v4l2_cap; /* capabilities */
776 return 0; 776 return 0;
@@ -1517,12 +1517,12 @@ static int ivtv_log_status(struct file *file, void *fh)
1517 } 1517 }
1518 IVTV_INFO("Tuner: %s\n", 1518 IVTV_INFO("Tuner: %s\n",
1519 test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); 1519 test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV");
1520 cx2341x_log_status(&itv->params, itv->device.name); 1520 cx2341x_log_status(&itv->params, itv->v4l2_dev.name);
1521 IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); 1521 IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags);
1522 for (i = 0; i < IVTV_MAX_STREAMS; i++) { 1522 for (i = 0; i < IVTV_MAX_STREAMS; i++) {
1523 struct ivtv_stream *s = &itv->streams[i]; 1523 struct ivtv_stream *s = &itv->streams[i];
1524 1524
1525 if (s->v4l2dev == NULL || s->buffers == 0) 1525 if (s->vdev == NULL || s->buffers == 0)
1526 continue; 1526 continue;
1527 IVTV_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", s->name, s->s_flags, 1527 IVTV_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", s->name, s->s_flags,
1528 (s->buffers - s->q_free.buffers) * 100 / s->buffers, 1528 (s->buffers - s->q_free.buffers) * 100 / s->buffers,
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c
index f5d00ec5da7..01c14d2b381 100644
--- a/drivers/media/video/ivtv/ivtv-irq.c
+++ b/drivers/media/video/ivtv/ivtv-irq.c
@@ -46,7 +46,7 @@ static void ivtv_pio_work_handler(struct ivtv *itv)
46 46
47 IVTV_DEBUG_HI_DMA("ivtv_pio_work_handler\n"); 47 IVTV_DEBUG_HI_DMA("ivtv_pio_work_handler\n");
48 if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS || 48 if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS ||
49 s->v4l2dev == NULL || !ivtv_use_pio(s)) { 49 s->vdev == NULL || !ivtv_use_pio(s)) {
50 itv->cur_pio_stream = -1; 50 itv->cur_pio_stream = -1;
51 /* trigger PIO complete user interrupt */ 51 /* trigger PIO complete user interrupt */
52 write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); 52 write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44);
@@ -109,7 +109,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA
109 int rc; 109 int rc;
110 110
111 /* sanity checks */ 111 /* sanity checks */
112 if (s->v4l2dev == NULL) { 112 if (s->vdev == NULL) {
113 IVTV_DEBUG_WARN("Stream %s not started\n", s->name); 113 IVTV_DEBUG_WARN("Stream %s not started\n", s->name);
114 return -1; 114 return -1;
115 } 115 }
diff --git a/drivers/media/video/ivtv/ivtv-queue.c b/drivers/media/video/ivtv/ivtv-queue.c
index 71bd13e22e2..ff7b7deded4 100644
--- a/drivers/media/video/ivtv/ivtv-queue.c
+++ b/drivers/media/video/ivtv/ivtv-queue.c
@@ -230,7 +230,7 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
230 return -ENOMEM; 230 return -ENOMEM;
231 } 231 }
232 if (ivtv_might_use_dma(s)) { 232 if (ivtv_might_use_dma(s)) {
233 s->sg_handle = pci_map_single(itv->dev, s->sg_dma, sizeof(struct ivtv_sg_element), s->dma); 233 s->sg_handle = pci_map_single(itv->pdev, s->sg_dma, sizeof(struct ivtv_sg_element), s->dma);
234 ivtv_stream_sync_for_cpu(s); 234 ivtv_stream_sync_for_cpu(s);
235 } 235 }
236 236
@@ -248,7 +248,7 @@ int ivtv_stream_alloc(struct ivtv_stream *s)
248 } 248 }
249 INIT_LIST_HEAD(&buf->list); 249 INIT_LIST_HEAD(&buf->list);
250 if (ivtv_might_use_dma(s)) { 250 if (ivtv_might_use_dma(s)) {
251 buf->dma_handle = pci_map_single(s->itv->dev, 251 buf->dma_handle = pci_map_single(s->itv->pdev,
252 buf->buf, s->buf_size + 256, s->dma); 252 buf->buf, s->buf_size + 256, s->dma);
253 ivtv_buf_sync_for_cpu(s, buf); 253 ivtv_buf_sync_for_cpu(s, buf);
254 } 254 }
@@ -271,7 +271,7 @@ void ivtv_stream_free(struct ivtv_stream *s)
271 /* empty q_free */ 271 /* empty q_free */
272 while ((buf = ivtv_dequeue(s, &s->q_free))) { 272 while ((buf = ivtv_dequeue(s, &s->q_free))) {
273 if (ivtv_might_use_dma(s)) 273 if (ivtv_might_use_dma(s))
274 pci_unmap_single(s->itv->dev, buf->dma_handle, 274 pci_unmap_single(s->itv->pdev, buf->dma_handle,
275 s->buf_size + 256, s->dma); 275 s->buf_size + 256, s->dma);
276 kfree(buf->buf); 276 kfree(buf->buf);
277 kfree(buf); 277 kfree(buf);
@@ -280,7 +280,7 @@ void ivtv_stream_free(struct ivtv_stream *s)
280 /* Free SG Array/Lists */ 280 /* Free SG Array/Lists */
281 if (s->sg_dma != NULL) { 281 if (s->sg_dma != NULL) {
282 if (s->sg_handle != IVTV_DMA_UNMAPPED) { 282 if (s->sg_handle != IVTV_DMA_UNMAPPED) {
283 pci_unmap_single(s->itv->dev, s->sg_handle, 283 pci_unmap_single(s->itv->pdev, s->sg_handle,
284 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE); 284 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE);
285 s->sg_handle = IVTV_DMA_UNMAPPED; 285 s->sg_handle = IVTV_DMA_UNMAPPED;
286 } 286 }
diff --git a/drivers/media/video/ivtv/ivtv-queue.h b/drivers/media/video/ivtv/ivtv-queue.h
index 476556afd39..91233839a26 100644
--- a/drivers/media/video/ivtv/ivtv-queue.h
+++ b/drivers/media/video/ivtv/ivtv-queue.h
@@ -53,14 +53,14 @@ static inline int ivtv_use_dma(struct ivtv_stream *s)
53static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) 53static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf)
54{ 54{
55 if (ivtv_use_dma(s)) 55 if (ivtv_use_dma(s))
56 pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, 56 pci_dma_sync_single_for_cpu(s->itv->pdev, buf->dma_handle,
57 s->buf_size + 256, s->dma); 57 s->buf_size + 256, s->dma);
58} 58}
59 59
60static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) 60static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf)
61{ 61{
62 if (ivtv_use_dma(s)) 62 if (ivtv_use_dma(s))
63 pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, 63 pci_dma_sync_single_for_device(s->itv->pdev, buf->dma_handle,
64 s->buf_size + 256, s->dma); 64 s->buf_size + 256, s->dma);
65} 65}
66 66
@@ -82,14 +82,14 @@ void ivtv_stream_free(struct ivtv_stream *s);
82static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) 82static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s)
83{ 83{
84 if (ivtv_use_dma(s)) 84 if (ivtv_use_dma(s))
85 pci_dma_sync_single_for_cpu(s->itv->dev, s->sg_handle, 85 pci_dma_sync_single_for_cpu(s->itv->pdev, s->sg_handle,
86 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE); 86 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE);
87} 87}
88 88
89static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) 89static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s)
90{ 90{
91 if (ivtv_use_dma(s)) 91 if (ivtv_use_dma(s))
92 pci_dma_sync_single_for_device(s->itv->dev, s->sg_handle, 92 pci_dma_sync_single_for_device(s->itv->pdev, s->sg_handle,
93 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE); 93 sizeof(struct ivtv_sg_element), PCI_DMA_TODEVICE);
94} 94}
95 95
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index 854a950af78..15da01710ef 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -137,11 +137,11 @@ static struct {
137static void ivtv_stream_init(struct ivtv *itv, int type) 137static void ivtv_stream_init(struct ivtv *itv, int type)
138{ 138{
139 struct ivtv_stream *s = &itv->streams[type]; 139 struct ivtv_stream *s = &itv->streams[type];
140 struct video_device *dev = s->v4l2dev; 140 struct video_device *vdev = s->vdev;
141 141
142 /* we need to keep v4l2dev, so restore it afterwards */ 142 /* we need to keep vdev, so restore it afterwards */
143 memset(s, 0, sizeof(*s)); 143 memset(s, 0, sizeof(*s));
144 s->v4l2dev = dev; 144 s->vdev = vdev;
145 145
146 /* initialize ivtv_stream fields */ 146 /* initialize ivtv_stream fields */
147 s->itv = itv; 147 s->itv = itv;
@@ -172,10 +172,10 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
172 int num_offset = ivtv_stream_info[type].num_offset; 172 int num_offset = ivtv_stream_info[type].num_offset;
173 int num = itv->instance + ivtv_first_minor + num_offset; 173 int num = itv->instance + ivtv_first_minor + num_offset;
174 174
175 /* These four fields are always initialized. If v4l2dev == NULL, then 175 /* These four fields are always initialized. If vdev == NULL, then
176 this stream is not in use. In that case no other fields but these 176 this stream is not in use. In that case no other fields but these
177 four can be used. */ 177 four can be used. */
178 s->v4l2dev = NULL; 178 s->vdev = NULL;
179 s->itv = itv; 179 s->itv = itv;
180 s->type = type; 180 s->type = type;
181 s->name = ivtv_stream_info[type].name; 181 s->name = ivtv_stream_info[type].name;
@@ -197,21 +197,21 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
197 ivtv_stream_init(itv, type); 197 ivtv_stream_init(itv, type);
198 198
199 /* allocate and initialize the v4l2 video device structure */ 199 /* allocate and initialize the v4l2 video device structure */
200 s->v4l2dev = video_device_alloc(); 200 s->vdev = video_device_alloc();
201 if (s->v4l2dev == NULL) { 201 if (s->vdev == NULL) {
202 IVTV_ERR("Couldn't allocate v4l2 video_device for %s\n", s->name); 202 IVTV_ERR("Couldn't allocate v4l2 video_device for %s\n", s->name);
203 return -ENOMEM; 203 return -ENOMEM;
204 } 204 }
205 205
206 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "%s %s", 206 snprintf(s->vdev->name, sizeof(s->vdev->name), "%s %s",
207 itv->device.name, s->name); 207 itv->v4l2_dev.name, s->name);
208 208
209 s->v4l2dev->num = num; 209 s->vdev->num = num;
210 s->v4l2dev->v4l2_dev = &itv->device; 210 s->vdev->v4l2_dev = &itv->v4l2_dev;
211 s->v4l2dev->fops = ivtv_stream_info[type].fops; 211 s->vdev->fops = ivtv_stream_info[type].fops;
212 s->v4l2dev->release = video_device_release; 212 s->vdev->release = video_device_release;
213 s->v4l2dev->tvnorms = V4L2_STD_ALL; 213 s->vdev->tvnorms = V4L2_STD_ALL;
214 ivtv_set_funcs(s->v4l2dev); 214 ivtv_set_funcs(s->vdev);
215 return 0; 215 return 0;
216} 216}
217 217
@@ -226,7 +226,7 @@ int ivtv_streams_setup(struct ivtv *itv)
226 if (ivtv_prep_dev(itv, type)) 226 if (ivtv_prep_dev(itv, type))
227 break; 227 break;
228 228
229 if (itv->streams[type].v4l2dev == NULL) 229 if (itv->streams[type].vdev == NULL)
230 continue; 230 continue;
231 231
232 /* Allocate Stream */ 232 /* Allocate Stream */
@@ -247,28 +247,28 @@ static int ivtv_reg_dev(struct ivtv *itv, int type)
247 int vfl_type = ivtv_stream_info[type].vfl_type; 247 int vfl_type = ivtv_stream_info[type].vfl_type;
248 int num; 248 int num;
249 249
250 if (s->v4l2dev == NULL) 250 if (s->vdev == NULL)
251 return 0; 251 return 0;
252 252
253 num = s->v4l2dev->num; 253 num = s->vdev->num;
254 /* card number + user defined offset + device offset */ 254 /* card number + user defined offset + device offset */
255 if (type != IVTV_ENC_STREAM_TYPE_MPG) { 255 if (type != IVTV_ENC_STREAM_TYPE_MPG) {
256 struct ivtv_stream *s_mpg = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG]; 256 struct ivtv_stream *s_mpg = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG];
257 257
258 if (s_mpg->v4l2dev) 258 if (s_mpg->vdev)
259 num = s_mpg->v4l2dev->num + ivtv_stream_info[type].num_offset; 259 num = s_mpg->vdev->num + ivtv_stream_info[type].num_offset;
260 } 260 }
261 video_set_drvdata(s->v4l2dev, s); 261 video_set_drvdata(s->vdev, s);
262 262
263 /* Register device. First try the desired minor, then any free one. */ 263 /* Register device. First try the desired minor, then any free one. */
264 if (video_register_device(s->v4l2dev, vfl_type, num)) { 264 if (video_register_device(s->vdev, vfl_type, num)) {
265 IVTV_ERR("Couldn't register v4l2 device for %s kernel number %d\n", 265 IVTV_ERR("Couldn't register v4l2 device for %s kernel number %d\n",
266 s->name, num); 266 s->name, num);
267 video_device_release(s->v4l2dev); 267 video_device_release(s->vdev);
268 s->v4l2dev = NULL; 268 s->vdev = NULL;
269 return -ENOMEM; 269 return -ENOMEM;
270 } 270 }
271 num = s->v4l2dev->num; 271 num = s->vdev->num;
272 272
273 switch (vfl_type) { 273 switch (vfl_type) {
274 case VFL_TYPE_GRABBER: 274 case VFL_TYPE_GRABBER:
@@ -316,9 +316,9 @@ void ivtv_streams_cleanup(struct ivtv *itv, int unregister)
316 316
317 /* Teardown all streams */ 317 /* Teardown all streams */
318 for (type = 0; type < IVTV_MAX_STREAMS; type++) { 318 for (type = 0; type < IVTV_MAX_STREAMS; type++) {
319 struct video_device *vdev = itv->streams[type].v4l2dev; 319 struct video_device *vdev = itv->streams[type].vdev;
320 320
321 itv->streams[type].v4l2dev = NULL; 321 itv->streams[type].vdev = NULL;
322 if (vdev == NULL) 322 if (vdev == NULL)
323 continue; 323 continue;
324 324
@@ -449,7 +449,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s)
449 int captype = 0, subtype = 0; 449 int captype = 0, subtype = 0;
450 int enable_passthrough = 0; 450 int enable_passthrough = 0;
451 451
452 if (s->v4l2dev == NULL) 452 if (s->vdev == NULL)
453 return -EINVAL; 453 return -EINVAL;
454 454
455 IVTV_DEBUG_INFO("Start encoder stream %s\n", s->name); 455 IVTV_DEBUG_INFO("Start encoder stream %s\n", s->name);
@@ -611,7 +611,7 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
611 struct cx2341x_mpeg_params *p = &itv->params; 611 struct cx2341x_mpeg_params *p = &itv->params;
612 int datatype; 612 int datatype;
613 613
614 if (s->v4l2dev == NULL) 614 if (s->vdev == NULL)
615 return -EINVAL; 615 return -EINVAL;
616 616
617 IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); 617 IVTV_DEBUG_INFO("Setting some initial decoder settings\n");
@@ -657,7 +657,7 @@ int ivtv_start_v4l2_decode_stream(struct ivtv_stream *s, int gop_offset)
657{ 657{
658 struct ivtv *itv = s->itv; 658 struct ivtv *itv = s->itv;
659 659
660 if (s->v4l2dev == NULL) 660 if (s->vdev == NULL)
661 return -EINVAL; 661 return -EINVAL;
662 662
663 if (test_and_set_bit(IVTV_F_S_STREAMING, &s->s_flags)) 663 if (test_and_set_bit(IVTV_F_S_STREAMING, &s->s_flags))
@@ -705,7 +705,7 @@ void ivtv_stop_all_captures(struct ivtv *itv)
705 for (i = IVTV_MAX_STREAMS - 1; i >= 0; i--) { 705 for (i = IVTV_MAX_STREAMS - 1; i >= 0; i--) {
706 struct ivtv_stream *s = &itv->streams[i]; 706 struct ivtv_stream *s = &itv->streams[i];
707 707
708 if (s->v4l2dev == NULL) 708 if (s->vdev == NULL)
709 continue; 709 continue;
710 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { 710 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
711 ivtv_stop_v4l2_encode_stream(s, 0); 711 ivtv_stop_v4l2_encode_stream(s, 0);
@@ -720,7 +720,7 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end)
720 int cap_type; 720 int cap_type;
721 int stopmode; 721 int stopmode;
722 722
723 if (s->v4l2dev == NULL) 723 if (s->vdev == NULL)
724 return -EINVAL; 724 return -EINVAL;
725 725
726 /* This function assumes that you are allowed to stop the capture 726 /* This function assumes that you are allowed to stop the capture
@@ -834,7 +834,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts)
834{ 834{
835 struct ivtv *itv = s->itv; 835 struct ivtv *itv = s->itv;
836 836
837 if (s->v4l2dev == NULL) 837 if (s->vdev == NULL)
838 return -EINVAL; 838 return -EINVAL;
839 839
840 if (s->type != IVTV_DEC_STREAM_TYPE_YUV && s->type != IVTV_DEC_STREAM_TYPE_MPG) 840 if (s->type != IVTV_DEC_STREAM_TYPE_YUV && s->type != IVTV_DEC_STREAM_TYPE_MPG)
@@ -895,7 +895,7 @@ int ivtv_passthrough_mode(struct ivtv *itv, int enable)
895 struct ivtv_stream *yuv_stream = &itv->streams[IVTV_ENC_STREAM_TYPE_YUV]; 895 struct ivtv_stream *yuv_stream = &itv->streams[IVTV_ENC_STREAM_TYPE_YUV];
896 struct ivtv_stream *dec_stream = &itv->streams[IVTV_DEC_STREAM_TYPE_YUV]; 896 struct ivtv_stream *dec_stream = &itv->streams[IVTV_DEC_STREAM_TYPE_YUV];
897 897
898 if (yuv_stream->v4l2dev == NULL || dec_stream->v4l2dev == NULL) 898 if (yuv_stream->vdev == NULL || dec_stream->vdev == NULL)
899 return -EINVAL; 899 return -EINVAL;
900 900
901 IVTV_DEBUG_INFO("ivtv ioctl: Select passthrough mode\n"); 901 IVTV_DEBUG_INFO("ivtv ioctl: Select passthrough mode\n");
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c
index 460db03b0ba..d07ad6c3902 100644
--- a/drivers/media/video/ivtv/ivtv-udma.c
+++ b/drivers/media/video/ivtv/ivtv-udma.c
@@ -93,7 +93,7 @@ void ivtv_udma_alloc(struct ivtv *itv)
93{ 93{
94 if (itv->udma.SG_handle == 0) { 94 if (itv->udma.SG_handle == 0) {
95 /* Map DMA Page Array Buffer */ 95 /* Map DMA Page Array Buffer */
96 itv->udma.SG_handle = pci_map_single(itv->dev, itv->udma.SGarray, 96 itv->udma.SG_handle = pci_map_single(itv->pdev, itv->udma.SGarray,
97 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE); 97 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE);
98 ivtv_udma_sync_for_cpu(itv); 98 ivtv_udma_sync_for_cpu(itv);
99 } 99 }
@@ -147,7 +147,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
147 } 147 }
148 148
149 /* Map SG List */ 149 /* Map SG List */
150 dma->SG_length = pci_map_sg(itv->dev, dma->SGlist, dma->page_count, PCI_DMA_TODEVICE); 150 dma->SG_length = pci_map_sg(itv->pdev, dma->SGlist, dma->page_count, PCI_DMA_TODEVICE);
151 151
152 /* Fill SG Array with new values */ 152 /* Fill SG Array with new values */
153 ivtv_udma_fill_sg_array (dma, ivtv_dest_addr, 0, -1); 153 ivtv_udma_fill_sg_array (dma, ivtv_dest_addr, 0, -1);
@@ -172,7 +172,7 @@ void ivtv_udma_unmap(struct ivtv *itv)
172 172
173 /* Unmap Scatterlist */ 173 /* Unmap Scatterlist */
174 if (dma->SG_length) { 174 if (dma->SG_length) {
175 pci_unmap_sg(itv->dev, dma->SGlist, dma->page_count, PCI_DMA_TODEVICE); 175 pci_unmap_sg(itv->pdev, dma->SGlist, dma->page_count, PCI_DMA_TODEVICE);
176 dma->SG_length = 0; 176 dma->SG_length = 0;
177 } 177 }
178 /* sync DMA */ 178 /* sync DMA */
@@ -191,13 +191,13 @@ void ivtv_udma_free(struct ivtv *itv)
191 191
192 /* Unmap SG Array */ 192 /* Unmap SG Array */
193 if (itv->udma.SG_handle) { 193 if (itv->udma.SG_handle) {
194 pci_unmap_single(itv->dev, itv->udma.SG_handle, 194 pci_unmap_single(itv->pdev, itv->udma.SG_handle,
195 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE); 195 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE);
196 } 196 }
197 197
198 /* Unmap Scatterlist */ 198 /* Unmap Scatterlist */
199 if (itv->udma.SG_length) { 199 if (itv->udma.SG_length) {
200 pci_unmap_sg(itv->dev, itv->udma.SGlist, itv->udma.page_count, PCI_DMA_TODEVICE); 200 pci_unmap_sg(itv->pdev, itv->udma.SGlist, itv->udma.page_count, PCI_DMA_TODEVICE);
201 } 201 }
202 202
203 for (i = 0; i < IVTV_DMA_SG_OSD_ENT; i++) { 203 for (i = 0; i < IVTV_DMA_SG_OSD_ENT; i++) {
diff --git a/drivers/media/video/ivtv/ivtv-udma.h b/drivers/media/video/ivtv/ivtv-udma.h
index df727e23be0..ee3c9efb5b7 100644
--- a/drivers/media/video/ivtv/ivtv-udma.h
+++ b/drivers/media/video/ivtv/ivtv-udma.h
@@ -35,13 +35,13 @@ void ivtv_udma_start(struct ivtv *itv);
35 35
36static inline void ivtv_udma_sync_for_device(struct ivtv *itv) 36static inline void ivtv_udma_sync_for_device(struct ivtv *itv)
37{ 37{
38 pci_dma_sync_single_for_device((struct pci_dev *)itv->dev, itv->udma.SG_handle, 38 pci_dma_sync_single_for_device(itv->pdev, itv->udma.SG_handle,
39 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE); 39 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE);
40} 40}
41 41
42static inline void ivtv_udma_sync_for_cpu(struct ivtv *itv) 42static inline void ivtv_udma_sync_for_cpu(struct ivtv *itv)
43{ 43{
44 pci_dma_sync_single_for_cpu((struct pci_dev *)itv->dev, itv->udma.SG_handle, 44 pci_dma_sync_single_for_cpu(itv->pdev, itv->udma.SG_handle,
45 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE); 45 sizeof(itv->udma.SGarray), PCI_DMA_TODEVICE);
46} 46}
47 47
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c
index ee91107376c..7912ed6b72e 100644
--- a/drivers/media/video/ivtv/ivtv-yuv.c
+++ b/drivers/media/video/ivtv/ivtv-yuv.c
@@ -103,7 +103,7 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
103 dma->page_count = 0; 103 dma->page_count = 0;
104 return -ENOMEM; 104 return -ENOMEM;
105 } 105 }
106 dma->SG_length = pci_map_sg(itv->dev, dma->SGlist, dma->page_count, PCI_DMA_TODEVICE); 106 dma->SG_length = pci_map_sg(itv->pdev, dma->SGlist, dma->page_count, PCI_DMA_TODEVICE);
107 107
108 /* Fill SG Array with new values */ 108 /* Fill SG Array with new values */
109 ivtv_udma_fill_sg_array(dma, y_buffer_offset, uv_buffer_offset, y_size); 109 ivtv_udma_fill_sg_array(dma, y_buffer_offset, uv_buffer_offset, y_size);
@@ -910,7 +910,7 @@ static void ivtv_yuv_init(struct ivtv *itv)
910 /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ 910 /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */
911 yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL|__GFP_NOWARN); 911 yi->blanking_ptr = kzalloc(720 * 16, GFP_KERNEL|__GFP_NOWARN);
912 if (yi->blanking_ptr) { 912 if (yi->blanking_ptr) {
913 yi->blanking_dmaptr = pci_map_single(itv->dev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE); 913 yi->blanking_dmaptr = pci_map_single(itv->pdev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE);
914 } else { 914 } else {
915 yi->blanking_dmaptr = 0; 915 yi->blanking_dmaptr = 0;
916 IVTV_DEBUG_WARN("Failed to allocate yuv blanking buffer\n"); 916 IVTV_DEBUG_WARN("Failed to allocate yuv blanking buffer\n");
@@ -1237,7 +1237,7 @@ void ivtv_yuv_close(struct ivtv *itv)
1237 if (yi->blanking_ptr) { 1237 if (yi->blanking_ptr) {
1238 kfree(yi->blanking_ptr); 1238 kfree(yi->blanking_ptr);
1239 yi->blanking_ptr = NULL; 1239 yi->blanking_ptr = NULL;
1240 pci_unmap_single(itv->dev, yi->blanking_dmaptr, 720*16, PCI_DMA_TODEVICE); 1240 pci_unmap_single(itv->pdev, yi->blanking_dmaptr, 720*16, PCI_DMA_TODEVICE);
1241 } 1241 }
1242 1242
1243 /* Invalidate the old dimension information */ 1243 /* Invalidate the old dimension information */
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index 36abd2aef6f..66e6eb51307 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -1192,12 +1192,12 @@ static int ivtvfb_init_card(struct ivtv *itv)
1192static int __init ivtvfb_callback_init(struct device *dev, void *p) 1192static int __init ivtvfb_callback_init(struct device *dev, void *p)
1193{ 1193{
1194 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); 1194 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
1195 struct ivtv *itv = container_of(v4l2_dev, struct ivtv, device); 1195 struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev);
1196 1196
1197 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { 1197 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
1198 if (ivtvfb_init_card(itv) == 0) { 1198 if (ivtvfb_init_card(itv) == 0) {
1199 IVTVFB_INFO("Framebuffer registered on %s\n", 1199 IVTVFB_INFO("Framebuffer registered on %s\n",
1200 itv->device.name); 1200 itv->v4l2_dev.name);
1201 (*(int *)p)++; 1201 (*(int *)p)++;
1202 } 1202 }
1203 } 1203 }
@@ -1207,7 +1207,7 @@ static int __init ivtvfb_callback_init(struct device *dev, void *p)
1207static int ivtvfb_callback_cleanup(struct device *dev, void *p) 1207static int ivtvfb_callback_cleanup(struct device *dev, void *p)
1208{ 1208{
1209 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); 1209 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
1210 struct ivtv *itv = container_of(v4l2_dev, struct ivtv, device); 1210 struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev);
1211 1211
1212 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { 1212 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
1213 if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { 1213 if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) {