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>
This commit is contained in:
parent
7568e3ce67
commit
5ddff43435
|
@ -220,7 +220,6 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
|
||||||
int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
|
int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
|
||||||
{
|
{
|
||||||
void *dev=q->dev;
|
void *dev=q->dev;
|
||||||
struct videobuf_dma_sg_ops *ops=q->priv_ops;
|
|
||||||
|
|
||||||
MAGIC_CHECK(dma->magic,MAGIC_DMABUF);
|
MAGIC_CHECK(dma->magic,MAGIC_DMABUF);
|
||||||
BUG_ON(0 == dma->nr_pages);
|
BUG_ON(0 == dma->nr_pages);
|
||||||
|
@ -247,10 +246,8 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
if (!dma->bus_addr) {
|
if (!dma->bus_addr) {
|
||||||
if (ops && ops->vb_map_sg) {
|
dma->sglen = pci_map_sg(dev,dma->sglist,
|
||||||
dma->sglen = ops->vb_map_sg(dev,dma->sglist,
|
|
||||||
dma->nr_pages, dma->direction);
|
dma->nr_pages, dma->direction);
|
||||||
}
|
|
||||||
if (0 == dma->sglen) {
|
if (0 == dma->sglen) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"%s: videobuf_map_sg failed\n",__FUNCTION__);
|
"%s: videobuf_map_sg failed\n",__FUNCTION__);
|
||||||
|
@ -266,30 +263,24 @@ int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
|
||||||
int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma)
|
int videobuf_dma_sync(struct videobuf_queue *q,struct videobuf_dmabuf *dma)
|
||||||
{
|
{
|
||||||
void *dev=q->dev;
|
void *dev=q->dev;
|
||||||
struct videobuf_dma_sg_ops *ops=q->priv_ops;
|
|
||||||
|
|
||||||
MAGIC_CHECK(dma->magic,MAGIC_DMABUF);
|
MAGIC_CHECK(dma->magic,MAGIC_DMABUF);
|
||||||
BUG_ON(!dma->sglen);
|
BUG_ON(!dma->sglen);
|
||||||
|
|
||||||
if (!dma->bus_addr && ops && ops->vb_dma_sync_sg)
|
pci_dma_sync_sg_for_cpu (dev,dma->sglist,dma->nr_pages,dma->direction);
|
||||||
ops->vb_dma_sync_sg(dev,dma->sglist,dma->nr_pages,
|
|
||||||
dma->direction);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
|
int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma)
|
||||||
{
|
{
|
||||||
void *dev=q->dev;
|
void *dev=q->dev;
|
||||||
struct videobuf_dma_sg_ops *ops=q->priv_ops;
|
|
||||||
|
|
||||||
MAGIC_CHECK(dma->magic,MAGIC_DMABUF);
|
MAGIC_CHECK(dma->magic,MAGIC_DMABUF);
|
||||||
if (!dma->sglen)
|
if (!dma->sglen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!dma->bus_addr && ops && ops->vb_unmap_sg)
|
pci_unmap_sg (dev,dma->sglist,dma->nr_pages,dma->direction);
|
||||||
ops->vb_unmap_sg(dev,dma->sglist,dma->nr_pages,
|
|
||||||
dma->direction);
|
|
||||||
kfree(dma->sglist);
|
kfree(dma->sglist);
|
||||||
dma->sglist = NULL;
|
dma->sglist = NULL;
|
||||||
dma->sglen = 0;
|
dma->sglen = 0;
|
||||||
|
@ -325,12 +316,8 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
|
||||||
int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma)
|
int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma)
|
||||||
{
|
{
|
||||||
struct videobuf_queue q;
|
struct videobuf_queue q;
|
||||||
struct videobuf_dma_sg_ops qops;
|
|
||||||
|
|
||||||
q.dev=pci;
|
q.dev=pci;
|
||||||
qops.vb_map_sg=(vb_map_sg_t *)pci_map_sg;
|
|
||||||
qops.vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg;
|
|
||||||
q.priv_ops = &qops;
|
|
||||||
|
|
||||||
return (videobuf_dma_map(&q,dma));
|
return (videobuf_dma_map(&q,dma));
|
||||||
}
|
}
|
||||||
|
@ -338,12 +325,8 @@ int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma)
|
||||||
int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma)
|
int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma)
|
||||||
{
|
{
|
||||||
struct videobuf_queue q;
|
struct videobuf_queue q;
|
||||||
struct videobuf_dma_sg_ops qops;
|
|
||||||
|
|
||||||
q.dev=pci;
|
q.dev=pci;
|
||||||
qops.vb_map_sg=(vb_map_sg_t *)pci_map_sg;
|
|
||||||
qops.vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg;
|
|
||||||
q.priv_ops = &qops;
|
|
||||||
|
|
||||||
return (videobuf_dma_unmap(&q,dma));
|
return (videobuf_dma_unmap(&q,dma));
|
||||||
}
|
}
|
||||||
|
@ -712,46 +695,10 @@ void videobuf_queue_pci_init(struct videobuf_queue* q,
|
||||||
unsigned int msize,
|
unsigned int msize,
|
||||||
void *priv)
|
void *priv)
|
||||||
{
|
{
|
||||||
struct videobuf_dma_sg_ops *priv_ops;
|
|
||||||
|
|
||||||
videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv);
|
videobuf_queue_init(q, ops, dev, irqlock, type, field, msize, priv);
|
||||||
q->int_ops=&pci_ops;
|
q->int_ops=&pci_ops;
|
||||||
|
|
||||||
/* FIXME: the code bellow should be removed after having a proper
|
|
||||||
* memory allocation method for vivi and tm6000
|
|
||||||
*/
|
|
||||||
q->priv_ops= kzalloc(sizeof(struct videobuf_dma_sg_ops), GFP_KERNEL);
|
|
||||||
BUG_ON (!q->priv_ops);
|
|
||||||
|
|
||||||
priv_ops=q->priv_ops;
|
|
||||||
|
|
||||||
/* Sets default methods for handling Scatter Gather mapping */
|
|
||||||
priv_ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg;
|
|
||||||
priv_ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg;
|
|
||||||
priv_ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void videobuf_set_pci_ops (struct videobuf_queue* q,
|
|
||||||
struct videobuf_dma_sg_ops *ops)
|
|
||||||
{
|
|
||||||
kfree (q->priv_ops);
|
|
||||||
|
|
||||||
q->priv_ops=ops;
|
|
||||||
|
|
||||||
if (!ops)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* If not specified, defaults to PCI map sg */
|
|
||||||
if (!ops->vb_map_sg)
|
|
||||||
ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg;
|
|
||||||
|
|
||||||
if (!ops->vb_dma_sync_sg)
|
|
||||||
ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu;
|
|
||||||
if (!ops->vb_unmap_sg)
|
|
||||||
ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg);
|
EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg);
|
||||||
|
@ -771,7 +718,6 @@ EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap);
|
||||||
EXPORT_SYMBOL_GPL(videobuf_pci_alloc);
|
EXPORT_SYMBOL_GPL(videobuf_pci_alloc);
|
||||||
|
|
||||||
EXPORT_SYMBOL_GPL(videobuf_queue_pci_init);
|
EXPORT_SYMBOL_GPL(videobuf_queue_pci_init);
|
||||||
EXPORT_SYMBOL_GPL(videobuf_set_pci_ops);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables:
|
* Local variables:
|
||||||
|
|
|
@ -173,9 +173,6 @@ struct videobuf_queue {
|
||||||
|
|
||||||
/* driver private data */
|
/* driver private data */
|
||||||
void *priv_data;
|
void *priv_data;
|
||||||
|
|
||||||
/*FIXME: should be removed after completing the vb conversion */
|
|
||||||
void *priv_ops;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
|
int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr);
|
||||||
|
|
|
@ -89,19 +89,6 @@ struct videbuf_pci_sg_memory
|
||||||
struct videobuf_dmabuf dma;
|
struct videobuf_dmabuf dma;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME: To be removed soon */
|
|
||||||
typedef int (vb_map_sg_t)(void *dev, struct scatterlist *sglist, int nr_pages,
|
|
||||||
int direction);
|
|
||||||
|
|
||||||
/* FIXME: To be removed soon */
|
|
||||||
struct videobuf_dma_sg_ops
|
|
||||||
{
|
|
||||||
vb_map_sg_t *vb_map_sg;
|
|
||||||
vb_map_sg_t *vb_dma_sync_sg;
|
|
||||||
vb_map_sg_t *vb_unmap_sg;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
void videobuf_dma_init(struct videobuf_dmabuf *dma);
|
void videobuf_dma_init(struct videobuf_dmabuf *dma);
|
||||||
int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
|
int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
|
||||||
unsigned long data, unsigned long size);
|
unsigned long data, unsigned long size);
|
||||||
|
@ -133,9 +120,3 @@ void videobuf_queue_pci_init(struct videobuf_queue* q,
|
||||||
int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma);
|
int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma);
|
||||||
int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma);
|
int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma);
|
||||||
|
|
||||||
/* FIXME: temporary routine for vivi and tm6000, while lacking implementation
|
|
||||||
* of videobuf-vmalloc
|
|
||||||
*/
|
|
||||||
void videobuf_set_pci_ops (struct videobuf_queue* q,
|
|
||||||
struct videobuf_dma_sg_ops *ops);
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue