aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx88
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-02-15 09:37:15 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-08 13:37:17 -0400
commit2bc46b3ad3c15165f91459b07ff8682478683194 (patch)
tree01a28e76142c4dde286157e7253fbd89dddc300b /drivers/media/pci/cx88
parent0e2f511894ceca86d2cc006a363a1be0b17ca359 (diff)
[media] media/pci: convert drivers to use the new vb2_queue dev field
Stop using alloc_ctx and just fill in the device pointer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Federico Vaga <federico.vaga@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci/cx88')
-rw-r--r--drivers/media/pci/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/pci/cx88/cx88-dvb.c2
-rw-r--r--drivers/media/pci/cx88/cx88-mpeg.c10
-rw-r--r--drivers/media/pci/cx88/cx88-vbi.c1
-rw-r--r--drivers/media/pci/cx88/cx88-video.c11
-rw-r--r--drivers/media/pci/cx88/cx88.h2
6 files changed, 5 insertions, 23 deletions
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c
index 3233d45d1e5b..7c026c1ca1fe 100644
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -647,7 +647,6 @@ static int queue_setup(struct vb2_queue *q,
647 dev->ts_packet_size = 188 * 4; 647 dev->ts_packet_size = 188 * 4;
648 dev->ts_packet_count = 32; 648 dev->ts_packet_count = 32;
649 sizes[0] = dev->ts_packet_size * dev->ts_packet_count; 649 sizes[0] = dev->ts_packet_size * dev->ts_packet_count;
650 alloc_ctxs[0] = dev->alloc_ctx;
651 return 0; 650 return 0;
652} 651}
653 652
@@ -1183,6 +1182,7 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
1183 q->mem_ops = &vb2_dma_sg_memops; 1182 q->mem_ops = &vb2_dma_sg_memops;
1184 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1183 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
1185 q->lock = &core->lock; 1184 q->lock = &core->lock;
1185 q->dev = &dev->pci->dev;
1186 1186
1187 err = vb2_queue_init(q); 1187 err = vb2_queue_init(q);
1188 if (err < 0) 1188 if (err < 0)
diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c
index 851d2a9caed3..4d91d1697419 100644
--- a/drivers/media/pci/cx88/cx88-dvb.c
+++ b/drivers/media/pci/cx88/cx88-dvb.c
@@ -92,7 +92,6 @@ static int queue_setup(struct vb2_queue *q,
92 dev->ts_packet_size = 188 * 4; 92 dev->ts_packet_size = 188 * 4;
93 dev->ts_packet_count = dvb_buf_tscnt; 93 dev->ts_packet_count = dvb_buf_tscnt;
94 sizes[0] = dev->ts_packet_size * dev->ts_packet_count; 94 sizes[0] = dev->ts_packet_size * dev->ts_packet_count;
95 alloc_ctxs[0] = dev->alloc_ctx;
96 *num_buffers = dvb_buf_tscnt; 95 *num_buffers = dvb_buf_tscnt;
97 return 0; 96 return 0;
98} 97}
@@ -1793,6 +1792,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
1793 q->mem_ops = &vb2_dma_sg_memops; 1792 q->mem_ops = &vb2_dma_sg_memops;
1794 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1793 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
1795 q->lock = &core->lock; 1794 q->lock = &core->lock;
1795 q->dev = &dev->pci->dev;
1796 1796
1797 err = vb2_queue_init(q); 1797 err = vb2_queue_init(q);
1798 if (err < 0) 1798 if (err < 0)
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c
index f34c229f9b37..245357adbc25 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -726,11 +726,6 @@ static int cx8802_probe(struct pci_dev *pci_dev,
726 if (NULL == dev) 726 if (NULL == dev)
727 goto fail_core; 727 goto fail_core;
728 dev->pci = pci_dev; 728 dev->pci = pci_dev;
729 dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
730 if (IS_ERR(dev->alloc_ctx)) {
731 err = PTR_ERR(dev->alloc_ctx);
732 goto fail_dev;
733 }
734 dev->core = core; 729 dev->core = core;
735 730
736 /* Maintain a reference so cx88-video can query the 8802 device. */ 731 /* Maintain a reference so cx88-video can query the 8802 device. */
@@ -738,7 +733,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
738 733
739 err = cx8802_init_common(dev); 734 err = cx8802_init_common(dev);
740 if (err != 0) 735 if (err != 0)
741 goto fail_free; 736 goto fail_dev;
742 737
743 INIT_LIST_HEAD(&dev->drvlist); 738 INIT_LIST_HEAD(&dev->drvlist);
744 mutex_lock(&cx8802_mutex); 739 mutex_lock(&cx8802_mutex);
@@ -749,8 +744,6 @@ static int cx8802_probe(struct pci_dev *pci_dev,
749 request_modules(dev); 744 request_modules(dev);
750 return 0; 745 return 0;
751 746
752 fail_free:
753 vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
754 fail_dev: 747 fail_dev:
755 kfree(dev); 748 kfree(dev);
756 fail_core: 749 fail_core:
@@ -798,7 +791,6 @@ static void cx8802_remove(struct pci_dev *pci_dev)
798 /* common */ 791 /* common */
799 cx8802_fini_common(dev); 792 cx8802_fini_common(dev);
800 cx88_core_put(dev->core,dev->pci); 793 cx88_core_put(dev->core,dev->pci);
801 vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
802 kfree(dev); 794 kfree(dev);
803} 795}
804 796
diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c
index ccc646d819f2..2479f7deccbf 100644
--- a/drivers/media/pci/cx88/cx88-vbi.c
+++ b/drivers/media/pci/cx88/cx88-vbi.c
@@ -118,7 +118,6 @@ static int queue_setup(struct vb2_queue *q,
118 sizes[0] = VBI_LINE_NTSC_COUNT * VBI_LINE_LENGTH * 2; 118 sizes[0] = VBI_LINE_NTSC_COUNT * VBI_LINE_LENGTH * 2;
119 else 119 else
120 sizes[0] = VBI_LINE_PAL_COUNT * VBI_LINE_LENGTH * 2; 120 sizes[0] = VBI_LINE_PAL_COUNT * VBI_LINE_LENGTH * 2;
121 alloc_ctxs[0] = dev->alloc_ctx;
122 return 0; 121 return 0;
123} 122}
124 123
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index 5f331df65fb9..9764d6fb382e 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -438,7 +438,6 @@ static int queue_setup(struct vb2_queue *q,
438 438
439 *num_planes = 1; 439 *num_planes = 1;
440 sizes[0] = (dev->fmt->depth * core->width * core->height) >> 3; 440 sizes[0] = (dev->fmt->depth * core->width * core->height) >> 3;
441 alloc_ctxs[0] = dev->alloc_ctx;
442 return 0; 441 return 0;
443} 442}
444 443
@@ -1319,12 +1318,6 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1319 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name); 1318 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name);
1320 goto fail_core; 1319 goto fail_core;
1321 } 1320 }
1322 dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
1323 if (IS_ERR(dev->alloc_ctx)) {
1324 err = PTR_ERR(dev->alloc_ctx);
1325 goto fail_core;
1326 }
1327
1328 1321
1329 /* initialize driver struct */ 1322 /* initialize driver struct */
1330 spin_lock_init(&dev->slock); 1323 spin_lock_init(&dev->slock);
@@ -1445,6 +1438,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1445 q->mem_ops = &vb2_dma_sg_memops; 1438 q->mem_ops = &vb2_dma_sg_memops;
1446 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1439 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
1447 q->lock = &core->lock; 1440 q->lock = &core->lock;
1441 q->dev = &dev->pci->dev;
1448 1442
1449 err = vb2_queue_init(q); 1443 err = vb2_queue_init(q);
1450 if (err < 0) 1444 if (err < 0)
@@ -1461,6 +1455,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1461 q->mem_ops = &vb2_dma_sg_memops; 1455 q->mem_ops = &vb2_dma_sg_memops;
1462 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1456 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
1463 q->lock = &core->lock; 1457 q->lock = &core->lock;
1458 q->dev = &dev->pci->dev;
1464 1459
1465 err = vb2_queue_init(q); 1460 err = vb2_queue_init(q);
1466 if (err < 0) 1461 if (err < 0)
@@ -1530,7 +1525,6 @@ fail_unreg:
1530 free_irq(pci_dev->irq, dev); 1525 free_irq(pci_dev->irq, dev);
1531 mutex_unlock(&core->lock); 1526 mutex_unlock(&core->lock);
1532fail_core: 1527fail_core:
1533 vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
1534 core->v4ldev = NULL; 1528 core->v4ldev = NULL;
1535 cx88_core_put(core,dev->pci); 1529 cx88_core_put(core,dev->pci);
1536fail_free: 1530fail_free:
@@ -1564,7 +1558,6 @@ static void cx8800_finidev(struct pci_dev *pci_dev)
1564 1558
1565 /* free memory */ 1559 /* free memory */
1566 cx88_core_put(core,dev->pci); 1560 cx88_core_put(core,dev->pci);
1567 vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
1568 kfree(dev); 1561 kfree(dev);
1569} 1562}
1570 1563
diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h
index 78f817ee7e41..ecd4b7bece99 100644
--- a/drivers/media/pci/cx88/cx88.h
+++ b/drivers/media/pci/cx88/cx88.h
@@ -485,7 +485,6 @@ struct cx8800_dev {
485 /* pci i/o */ 485 /* pci i/o */
486 struct pci_dev *pci; 486 struct pci_dev *pci;
487 unsigned char pci_rev,pci_lat; 487 unsigned char pci_rev,pci_lat;
488 void *alloc_ctx;
489 488
490 const struct cx8800_fmt *fmt; 489 const struct cx8800_fmt *fmt;
491 490
@@ -549,7 +548,6 @@ struct cx8802_dev {
549 /* pci i/o */ 548 /* pci i/o */
550 struct pci_dev *pci; 549 struct pci_dev *pci;
551 unsigned char pci_rev,pci_lat; 550 unsigned char pci_rev,pci_lat;
552 void *alloc_ctx;
553 551
554 /* dma queues */ 552 /* dma queues */
555 struct cx88_dmaqueue mpegq; 553 struct cx88_dmaqueue mpegq;