aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/media/video/cx18/cx18-av-firmware.c2
-rw-r--r--drivers/media/video/cx18/cx18-driver.c55
-rw-r--r--drivers/media/video/cx18/cx18-driver.h4
-rw-r--r--drivers/media/video/cx18/cx18-dvb.c2
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c2
-rw-r--r--drivers/media/video/cx18/cx18-firmware.c4
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c2
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c5
-rw-r--r--drivers/media/video/cx18/cx18-queue.c4
-rw-r--r--drivers/media/video/cx18/cx18-queue.h4
-rw-r--r--drivers/media/video/cx18/cx18-streams.c59
11 files changed, 73 insertions, 70 deletions
diff --git a/drivers/media/video/cx18/cx18-av-firmware.c b/drivers/media/video/cx18/cx18-av-firmware.c
index d1fa0289b067..b374c74d3e7b 100644
--- a/drivers/media/video/cx18/cx18-av-firmware.c
+++ b/drivers/media/video/cx18/cx18-av-firmware.c
@@ -36,7 +36,7 @@ int cx18_av_loadfw(struct cx18 *cx)
36 int i; 36 int i;
37 int retries1 = 0; 37 int retries1 = 0;
38 38
39 if (request_firmware(&fw, FWFILE, &cx->dev->dev) != 0) { 39 if (request_firmware(&fw, FWFILE, &cx->pci_dev->dev) != 0) {
40 CX18_ERR("unable to open firmware %s\n", FWFILE); 40 CX18_ERR("unable to open firmware %s\n", FWFILE);
41 return -EINVAL; 41 return -EINVAL;
42 } 42 }
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}
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 36809dd3d848..316ff333d4a5 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -279,7 +279,7 @@ struct cx18_epu_work_order {
279struct cx18_stream { 279struct cx18_stream {
280 /* These first four fields are always set, even if the stream 280 /* These first four fields are always set, even if the stream
281 is not actually created. */ 281 is not actually created. */
282 struct video_device *v4l2dev; /* NULL when stream not created */ 282 struct video_device *video_dev; /* NULL when stream not created */
283 struct cx18 *cx; /* for ease of use */ 283 struct cx18 *cx; /* for ease of use */
284 const char *name; /* name of the stream */ 284 const char *name; /* name of the stream */
285 int type; /* stream type */ 285 int type; /* stream type */
@@ -385,7 +385,7 @@ struct cx18_i2c_algo_callback_data {
385struct cx18 { 385struct cx18 {
386 int num; /* board number, -1 during init! */ 386 int num; /* board number, -1 during init! */
387 char name[8]; /* board name for printk and interrupts (e.g. 'cx180') */ 387 char name[8]; /* board name for printk and interrupts (e.g. 'cx180') */
388 struct pci_dev *dev; /* PCI device */ 388 struct pci_dev *pci_dev;
389 const struct cx18_card *card; /* card information */ 389 const struct cx18_card *card; /* card information */
390 const char *card_name; /* full name of the card */ 390 const char *card_name; /* full name of the card */
391 const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */ 391 const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c
index bd5e6f3fd4d0..3b86f57cd15a 100644
--- a/drivers/media/video/cx18/cx18-dvb.c
+++ b/drivers/media/video/cx18/cx18-dvb.c
@@ -167,7 +167,7 @@ int cx18_dvb_register(struct cx18_stream *stream)
167 167
168 ret = dvb_register_adapter(&dvb->dvb_adapter, 168 ret = dvb_register_adapter(&dvb->dvb_adapter,
169 CX18_DRIVER_NAME, 169 CX18_DRIVER_NAME,
170 THIS_MODULE, &cx->dev->dev, adapter_nr); 170 THIS_MODULE, &cx->pci_dev->dev, adapter_nr);
171 if (ret < 0) 171 if (ret < 0)
172 goto err_out; 172 goto err_out;
173 173
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 863d29db85eb..23006f7d9159 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -665,7 +665,7 @@ int cx18_v4l2_open(struct file *filp)
665 if (cx18_cards[x] == NULL) 665 if (cx18_cards[x] == NULL)
666 continue; 666 continue;
667 s = &cx18_cards[x]->streams[y]; 667 s = &cx18_cards[x]->streams[y];
668 if (s->v4l2dev && s->v4l2dev->minor == minor) { 668 if (s->video_dev && s->video_dev->minor == minor) {
669 cx = cx18_cards[x]; 669 cx = cx18_cards[x];
670 break; 670 break;
671 } 671 }
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c
index 1fa95da1575e..aa89bee65af0 100644
--- a/drivers/media/video/cx18/cx18-firmware.c
+++ b/drivers/media/video/cx18/cx18-firmware.c
@@ -107,7 +107,7 @@ static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx)
107 u32 __iomem *dst = (u32 __iomem *)mem; 107 u32 __iomem *dst = (u32 __iomem *)mem;
108 const u32 *src; 108 const u32 *src;
109 109
110 if (request_firmware(&fw, fn, &cx->dev->dev)) { 110 if (request_firmware(&fw, fn, &cx->pci_dev->dev)) {
111 CX18_ERR("Unable to open firmware %s\n", fn); 111 CX18_ERR("Unable to open firmware %s\n", fn);
112 CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n"); 112 CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n");
113 return -ENOMEM; 113 return -ENOMEM;
@@ -151,7 +151,7 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx,
151 u32 apu_version = 0; 151 u32 apu_version = 0;
152 int sz; 152 int sz;
153 153
154 if (request_firmware(&fw, fn, &cx->dev->dev)) { 154 if (request_firmware(&fw, fn, &cx->pci_dev->dev)) {
155 CX18_ERR("unable to open firmware %s\n", fn); 155 CX18_ERR("unable to open firmware %s\n", fn);
156 CX18_ERR("did you put the firmware in the hotplug firmware directory?\n"); 156 CX18_ERR("did you put the firmware in the hotplug firmware directory?\n");
157 cx18_setup_page(cx, 0); 157 cx18_setup_page(cx, 0);
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 83e1c6333126..200d9257a926 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -366,7 +366,7 @@ int init_cx18_i2c(struct cx18 *cx)
366 sprintf(cx->i2c_client[i].name + 366 sprintf(cx->i2c_client[i].name +
367 strlen(cx->i2c_client[i].name), "%d", i); 367 strlen(cx->i2c_client[i].name), "%d", i);
368 cx->i2c_client[i].adapter = &cx->i2c_adap[i]; 368 cx->i2c_client[i].adapter = &cx->i2c_adap[i];
369 cx->i2c_adap[i].dev.parent = &cx->dev->dev; 369 cx->i2c_adap[i].dev.parent = &cx->pci_dev->dev;
370 } 370 }
371 371
372 if (cx18_read_reg(cx, CX18_REG_I2C_2_WR) != 0x0003c02f) { 372 if (cx18_read_reg(cx, CX18_REG_I2C_2_WR) != 0x0003c02f) {
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index f38ca207cad2..20467fce5251 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -335,7 +335,8 @@ static int cx18_querycap(struct file *file, void *fh,
335 335
336 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); 336 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
337 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); 337 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
338 snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(cx->dev)); 338 snprintf(vcap->bus_info, sizeof(vcap->bus_info),
339 "PCI:%s", pci_name(cx->pci_dev));
339 vcap->version = CX18_DRIVER_VERSION; /* version */ 340 vcap->version = CX18_DRIVER_VERSION; /* version */
340 vcap->capabilities = cx->v4l2_cap; /* capabilities */ 341 vcap->capabilities = cx->v4l2_cap; /* capabilities */
341 return 0; 342 return 0;
@@ -732,7 +733,7 @@ static int cx18_log_status(struct file *file, void *fh)
732 for (i = 0; i < CX18_MAX_STREAMS; i++) { 733 for (i = 0; i < CX18_MAX_STREAMS; i++) {
733 struct cx18_stream *s = &cx->streams[i]; 734 struct cx18_stream *s = &cx->streams[i];
734 735
735 if (s->v4l2dev == NULL || s->buffers == 0) 736 if (s->video_dev == NULL || s->buffers == 0)
736 continue; 737 continue;
737 CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n", 738 CX18_INFO("Stream %s: status 0x%04lx, %d%% of %d KiB (%d buffers) in use\n",
738 s->name, s->s_flags, 739 s->name, s->s_flags,
diff --git a/drivers/media/video/cx18/cx18-queue.c b/drivers/media/video/cx18/cx18-queue.c
index 8d9441e88c4e..3046b8e74345 100644
--- a/drivers/media/video/cx18/cx18-queue.c
+++ b/drivers/media/video/cx18/cx18-queue.c
@@ -204,7 +204,7 @@ int cx18_stream_alloc(struct cx18_stream *s)
204 } 204 }
205 buf->id = cx->buffer_id++; 205 buf->id = cx->buffer_id++;
206 INIT_LIST_HEAD(&buf->list); 206 INIT_LIST_HEAD(&buf->list);
207 buf->dma_handle = pci_map_single(s->cx->dev, 207 buf->dma_handle = pci_map_single(s->cx->pci_dev,
208 buf->buf, s->buf_size, s->dma); 208 buf->buf, s->buf_size, s->dma);
209 cx18_buf_sync_for_cpu(s, buf); 209 cx18_buf_sync_for_cpu(s, buf);
210 cx18_enqueue(s, buf, &s->q_free); 210 cx18_enqueue(s, buf, &s->q_free);
@@ -227,7 +227,7 @@ void cx18_stream_free(struct cx18_stream *s)
227 227
228 /* empty q_free */ 228 /* empty q_free */
229 while ((buf = cx18_dequeue(s, &s->q_free))) { 229 while ((buf = cx18_dequeue(s, &s->q_free))) {
230 pci_unmap_single(s->cx->dev, buf->dma_handle, 230 pci_unmap_single(s->cx->pci_dev, buf->dma_handle,
231 s->buf_size, s->dma); 231 s->buf_size, s->dma);
232 kfree(buf->buf); 232 kfree(buf->buf);
233 kfree(buf); 233 kfree(buf);
diff --git a/drivers/media/video/cx18/cx18-queue.h b/drivers/media/video/cx18/cx18-queue.h
index 456cec3bc28f..4de06269d88f 100644
--- a/drivers/media/video/cx18/cx18-queue.h
+++ b/drivers/media/video/cx18/cx18-queue.h
@@ -29,14 +29,14 @@
29static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s, 29static inline void cx18_buf_sync_for_cpu(struct cx18_stream *s,
30 struct cx18_buffer *buf) 30 struct cx18_buffer *buf)
31{ 31{
32 pci_dma_sync_single_for_cpu(s->cx->dev, buf->dma_handle, 32 pci_dma_sync_single_for_cpu(s->cx->pci_dev, buf->dma_handle,
33 s->buf_size, s->dma); 33 s->buf_size, s->dma);
34} 34}
35 35
36static inline void cx18_buf_sync_for_device(struct cx18_stream *s, 36static inline void cx18_buf_sync_for_device(struct cx18_stream *s,
37 struct cx18_buffer *buf) 37 struct cx18_buffer *buf)
38{ 38{
39 pci_dma_sync_single_for_device(s->cx->dev, buf->dma_handle, 39 pci_dma_sync_single_for_device(s->cx->pci_dev, buf->dma_handle,
40 s->buf_size, s->dma); 40 s->buf_size, s->dma);
41} 41}
42 42
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 89c1ec94f335..abc3fe605f00 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -101,11 +101,11 @@ static struct {
101static void cx18_stream_init(struct cx18 *cx, int type) 101static void cx18_stream_init(struct cx18 *cx, int type)
102{ 102{
103 struct cx18_stream *s = &cx->streams[type]; 103 struct cx18_stream *s = &cx->streams[type];
104 struct video_device *dev = s->v4l2dev; 104 struct video_device *video_dev = s->video_dev;
105 105
106 /* we need to keep v4l2dev, so restore it afterwards */ 106 /* we need to keep video_dev, so restore it afterwards */
107 memset(s, 0, sizeof(*s)); 107 memset(s, 0, sizeof(*s));
108 s->v4l2dev = dev; 108 s->video_dev = video_dev;
109 109
110 /* initialize cx18_stream fields */ 110 /* initialize cx18_stream fields */
111 s->cx = cx; 111 s->cx = cx;
@@ -132,10 +132,10 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
132 int num_offset = cx18_stream_info[type].num_offset; 132 int num_offset = cx18_stream_info[type].num_offset;
133 int num = cx->num + cx18_first_minor + num_offset; 133 int num = cx->num + cx18_first_minor + num_offset;
134 134
135 /* These four fields are always initialized. If v4l2dev == NULL, then 135 /* These four fields are always initialized. If video_dev == NULL, then
136 this stream is not in use. In that case no other fields but these 136 this stream is not in use. In that case no other fields but these
137 four can be used. */ 137 four can be used. */
138 s->v4l2dev = NULL; 138 s->video_dev = NULL;
139 s->cx = cx; 139 s->cx = cx;
140 s->type = type; 140 s->type = type;
141 s->name = cx18_stream_info[type].name; 141 s->name = cx18_stream_info[type].name;
@@ -163,22 +163,22 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
163 return 0; 163 return 0;
164 164
165 /* allocate and initialize the v4l2 video device structure */ 165 /* allocate and initialize the v4l2 video device structure */
166 s->v4l2dev = video_device_alloc(); 166 s->video_dev = video_device_alloc();
167 if (s->v4l2dev == NULL) { 167 if (s->video_dev == NULL) {
168 CX18_ERR("Couldn't allocate v4l2 video_device for %s\n", 168 CX18_ERR("Couldn't allocate v4l2 video_device for %s\n",
169 s->name); 169 s->name);
170 return -ENOMEM; 170 return -ENOMEM;
171 } 171 }
172 172
173 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d", 173 snprintf(s->video_dev->name, sizeof(s->video_dev->name), "cx18-%d",
174 cx->num); 174 cx->num);
175 175
176 s->v4l2dev->num = num; 176 s->video_dev->num = num;
177 s->v4l2dev->parent = &cx->dev->dev; 177 s->video_dev->parent = &cx->pci_dev->dev;
178 s->v4l2dev->fops = &cx18_v4l2_enc_fops; 178 s->video_dev->fops = &cx18_v4l2_enc_fops;
179 s->v4l2dev->release = video_device_release; 179 s->video_dev->release = video_device_release;
180 s->v4l2dev->tvnorms = V4L2_STD_ALL; 180 s->video_dev->tvnorms = V4L2_STD_ALL;
181 cx18_set_funcs(s->v4l2dev); 181 cx18_set_funcs(s->video_dev);
182 return 0; 182 return 0;
183} 183}
184 184
@@ -227,28 +227,29 @@ static int cx18_reg_dev(struct cx18 *cx, int type)
227 } 227 }
228 } 228 }
229 229
230 if (s->v4l2dev == NULL) 230 if (s->video_dev == NULL)
231 return 0; 231 return 0;
232 232
233 num = s->v4l2dev->num; 233 num = s->video_dev->num;
234 /* card number + user defined offset + device offset */ 234 /* card number + user defined offset + device offset */
235 if (type != CX18_ENC_STREAM_TYPE_MPG) { 235 if (type != CX18_ENC_STREAM_TYPE_MPG) {
236 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG]; 236 struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];
237 237
238 if (s_mpg->v4l2dev) 238 if (s_mpg->video_dev)
239 num = s_mpg->v4l2dev->num + cx18_stream_info[type].num_offset; 239 num = s_mpg->video_dev->num
240 + cx18_stream_info[type].num_offset;
240 } 241 }
241 242
242 /* Register device. First try the desired minor, then any free one. */ 243 /* Register device. First try the desired minor, then any free one. */
243 ret = video_register_device(s->v4l2dev, vfl_type, num); 244 ret = video_register_device(s->video_dev, vfl_type, num);
244 if (ret < 0) { 245 if (ret < 0) {
245 CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n", 246 CX18_ERR("Couldn't register v4l2 device for %s kernel number %d\n",
246 s->name, num); 247 s->name, num);
247 video_device_release(s->v4l2dev); 248 video_device_release(s->video_dev);
248 s->v4l2dev = NULL; 249 s->video_dev = NULL;
249 return ret; 250 return ret;
250 } 251 }
251 num = s->v4l2dev->num; 252 num = s->video_dev->num;
252 253
253 switch (vfl_type) { 254 switch (vfl_type) {
254 case VFL_TYPE_GRABBER: 255 case VFL_TYPE_GRABBER:
@@ -312,9 +313,9 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
312 cx->streams[type].dvb.enabled = false; 313 cx->streams[type].dvb.enabled = false;
313 } 314 }
314 315
315 vdev = cx->streams[type].v4l2dev; 316 vdev = cx->streams[type].video_dev;
316 317
317 cx->streams[type].v4l2dev = NULL; 318 cx->streams[type].video_dev = NULL;
318 if (vdev == NULL) 319 if (vdev == NULL)
319 continue; 320 continue;
320 321
@@ -437,7 +438,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
437 int ts = 0; 438 int ts = 0;
438 int captype = 0; 439 int captype = 0;
439 440
440 if (s->v4l2dev == NULL && s->dvb.enabled == 0) 441 if (s->video_dev == NULL && s->dvb.enabled == 0)
441 return -EINVAL; 442 return -EINVAL;
442 443
443 CX18_DEBUG_INFO("Start encoder stream %s\n", s->name); 444 CX18_DEBUG_INFO("Start encoder stream %s\n", s->name);
@@ -565,7 +566,7 @@ void cx18_stop_all_captures(struct cx18 *cx)
565 for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) { 566 for (i = CX18_MAX_STREAMS - 1; i >= 0; i--) {
566 struct cx18_stream *s = &cx->streams[i]; 567 struct cx18_stream *s = &cx->streams[i];
567 568
568 if (s->v4l2dev == NULL && s->dvb.enabled == 0) 569 if (s->video_dev == NULL && s->dvb.enabled == 0)
569 continue; 570 continue;
570 if (test_bit(CX18_F_S_STREAMING, &s->s_flags)) 571 if (test_bit(CX18_F_S_STREAMING, &s->s_flags))
571 cx18_stop_v4l2_encode_stream(s, 0); 572 cx18_stop_v4l2_encode_stream(s, 0);
@@ -577,7 +578,7 @@ int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end)
577 struct cx18 *cx = s->cx; 578 struct cx18 *cx = s->cx;
578 unsigned long then; 579 unsigned long then;
579 580
580 if (s->v4l2dev == NULL && s->dvb.enabled == 0) 581 if (s->video_dev == NULL && s->dvb.enabled == 0)
581 return -EINVAL; 582 return -EINVAL;
582 583
583 /* This function assumes that you are allowed to stop the capture 584 /* This function assumes that you are allowed to stop the capture
@@ -629,7 +630,7 @@ u32 cx18_find_handle(struct cx18 *cx)
629 for (i = 0; i < CX18_MAX_STREAMS; i++) { 630 for (i = 0; i < CX18_MAX_STREAMS; i++) {
630 struct cx18_stream *s = &cx->streams[i]; 631 struct cx18_stream *s = &cx->streams[i];
631 632
632 if (s->v4l2dev && (s->handle != CX18_INVALID_TASK_HANDLE)) 633 if (s->video_dev && (s->handle != CX18_INVALID_TASK_HANDLE))
633 return s->handle; 634 return s->handle;
634 } 635 }
635 return CX18_INVALID_TASK_HANDLE; 636 return CX18_INVALID_TASK_HANDLE;
@@ -647,7 +648,7 @@ struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle)
647 s = &cx->streams[i]; 648 s = &cx->streams[i];
648 if (s->handle != handle) 649 if (s->handle != handle)
649 continue; 650 continue;
650 if (s->v4l2dev || s->dvb.enabled) 651 if (s->video_dev || s->dvb.enabled)
651 return s; 652 return s;
652 } 653 }
653 return NULL; 654 return NULL;