diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-08 10:43:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 23:03:10 -0400 |
commit | 5ddff43435394c1c2540fcdeed00cb54862c31bf (patch) | |
tree | dc61fc71d81cecbf2fe515da60760e94a8bc6f5c /drivers/media/video | |
parent | 7568e3ce6710cb2c1bc1564a273e9f222efbc95e (diff) |
V4L/DVB (6290): remove videobuf_set_pci_ops
Before the videobuf redesign, a procedure for re-using videobuf without PCI
scatter/gather where provided by changing the pci-dependent operations by
other operations.
With the newer approach, those methods are obsolete and can safelly be removed.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 62 |
1 files changed, 4 insertions, 58 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 05dd38343fa3..a38efe10feb4 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -220,7 +220,6 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | |||
220 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | 220 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
221 | { | 221 | { |
222 | void *dev=q->dev; | 222 | void *dev=q->dev; |
223 | struct videobuf_dma_sg_ops *ops=q->priv_ops; | ||
224 | 223 | ||
225 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 224 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
226 | BUG_ON(0 == dma->nr_pages); | 225 | BUG_ON(0 == dma->nr_pages); |
@@ -247,10 +246,8 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
247 | return -ENOMEM; | 246 | return -ENOMEM; |
248 | } | 247 | } |
249 | if (!dma->bus_addr) { | 248 | if (!dma->bus_addr) { |
250 | if (ops && ops->vb_map_sg) { | 249 | dma->sglen = pci_map_sg(dev,dma->sglist, |
251 | dma->sglen = ops->vb_map_sg(dev,dma->sglist, | ||
252 | dma->nr_pages, dma->direction); | 250 | dma->nr_pages, dma->direction); |
253 | } | ||
254 | if (0 == dma->sglen) { | 251 | if (0 == dma->sglen) { |
255 | printk(KERN_WARNING | 252 | printk(KERN_WARNING |
256 | "%s: videobuf_map_sg failed\n",__FUNCTION__); | 253 | "%s: videobuf_map_sg failed\n",__FUNCTION__); |
@@ -266,30 +263,24 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | |||
266 | int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma) | 263 | int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma) |
267 | { | 264 | { |
268 | void *dev=q->dev; | 265 | void *dev=q->dev; |
269 | struct videobuf_dma_sg_ops *ops=q->priv_ops; | ||
270 | 266 | ||
271 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 267 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
272 | BUG_ON(!dma->sglen); | 268 | BUG_ON(!dma->sglen); |
273 | 269 | ||
274 | if (!dma->bus_addr && ops && ops->vb_dma_sync_sg) | 270 | pci_dma_sync_sg_for_cpu (dev,dma->sglist,dma->nr_pages,dma->direction); |
275 | ops->vb_dma_sync_sg(dev,dma->sglist,dma->nr_pages, | ||
276 | dma->direction); | ||
277 | |||
278 | return 0; | 271 | return 0; |
279 | } | 272 | } |
280 | 273 | ||
281 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) | 274 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
282 | { | 275 | { |
283 | void *dev=q->dev; | 276 | void *dev=q->dev; |
284 | struct videobuf_dma_sg_ops *ops=q->priv_ops; | ||
285 | 277 | ||
286 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 278 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
287 | if (!dma->sglen) | 279 | if (!dma->sglen) |
288 | return 0; | 280 | return 0; |
289 | 281 | ||
290 | if (!dma->bus_addr && ops && ops->vb_unmap_sg) | 282 | pci_unmap_sg (dev,dma->sglist,dma->nr_pages,dma->direction); |
291 | ops->vb_unmap_sg(dev,dma->sglist,dma->nr_pages, | 283 | |
292 | dma->direction); | ||
293 | kfree(dma->sglist); | 284 | kfree(dma->sglist); |
294 | dma->sglist = NULL; | 285 | dma->sglist = NULL; |
295 | dma->sglen = 0; | 286 | dma->sglen = 0; |
@@ -325,12 +316,8 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) | |||
325 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | 316 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) |
326 | { | 317 | { |
327 | struct videobuf_queue q; | 318 | struct videobuf_queue q; |
328 | struct videobuf_dma_sg_ops qops; | ||
329 | 319 | ||
330 | q.dev=pci; | 320 | q.dev=pci; |
331 | qops.vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
332 | qops.vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
333 | q.priv_ops = &qops; | ||
334 | 321 | ||
335 | return (videobuf_dma_map(&q,dma)); | 322 | return (videobuf_dma_map(&q,dma)); |
336 | } | 323 | } |
@@ -338,12 +325,8 @@ int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | |||
338 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) | 325 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) |
339 | { | 326 | { |
340 | struct videobuf_queue q; | 327 | struct videobuf_queue q; |
341 | struct videobuf_dma_sg_ops qops; | ||
342 | 328 | ||
343 | q.dev=pci; | 329 | q.dev=pci; |
344 | qops.vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
345 | qops.vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
346 | q.priv_ops = &qops; | ||
347 | 330 | ||
348 | return (videobuf_dma_unmap(&q,dma)); | 331 | return (videobuf_dma_unmap(&q,dma)); |
349 | } | 332 | } |
@@ -712,46 +695,10 @@ void videobuf_queue_pci_init(struct videobuf_queue* q, | |||
712 | unsigned int msize, | 695 | unsigned int msize, |
713 | void *priv) | 696 | void *priv) |
714 | { | 697 | { |
715 | struct videobuf_dma_sg_ops *priv_ops; | ||
716 | |||
717 | videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv); | 698 | videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv); |
718 | q->int_ops=&pci_ops; | 699 | q->int_ops=&pci_ops; |
719 | |||
720 | /* FIXME: the code bellow should be removed after having a proper | ||
721 | * memory allocation method for vivi and tm6000 | ||
722 | */ | ||
723 | q->priv_ops= kzalloc(sizeof(struct videobuf_dma_sg_ops), GFP_KERNEL); | ||
724 | BUG_ON (!q->priv_ops); | ||
725 | |||
726 | priv_ops=q->priv_ops; | ||
727 | |||
728 | /* Sets default methods for handling Scatter Gather mapping */ | ||
729 | priv_ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
730 | priv_ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
731 | priv_ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; | ||
732 | } | 700 | } |
733 | 701 | ||
734 | void videobuf_set_pci_ops (struct videobuf_queue* q, | ||
735 | struct videobuf_dma_sg_ops *ops) | ||
736 | { | ||
737 | kfree (q->priv_ops); | ||
738 | |||
739 | q->priv_ops=ops; | ||
740 | |||
741 | if (!ops) | ||
742 | return; | ||
743 | |||
744 | /* If not specified, defaults to PCI map sg */ | ||
745 | if (!ops->vb_map_sg) | ||
746 | ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
747 | |||
748 | if (!ops->vb_dma_sync_sg) | ||
749 | ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; | ||
750 | if (!ops->vb_unmap_sg) | ||
751 | ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
752 | } | ||
753 | |||
754 | |||
755 | /* --------------------------------------------------------------------- */ | 702 | /* --------------------------------------------------------------------- */ |
756 | 703 | ||
757 | EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg); | 704 | EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg); |
@@ -771,7 +718,6 @@ EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap); | |||
771 | EXPORT_SYMBOL_GPL(videobuf_pci_alloc); | 718 | EXPORT_SYMBOL_GPL(videobuf_pci_alloc); |
772 | 719 | ||
773 | EXPORT_SYMBOL_GPL(videobuf_queue_pci_init); | 720 | EXPORT_SYMBOL_GPL(videobuf_queue_pci_init); |
774 | EXPORT_SYMBOL_GPL(videobuf_set_pci_ops); | ||
775 | 721 | ||
776 | /* | 722 | /* |
777 | * Local variables: | 723 | * Local variables: |