V4L/DVB: videobuf: Rename vmalloc fields to vaddr
The videobuf_dmabuf and videobuf_vmalloc_memory fields have a vmalloc field to store the kernel virtual address of vmalloc'ed buffers. Rename the field to vaddr. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
959794ddc0
commit
bb6dbe7480
|
@ -426,7 +426,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
|
||||||
chip->buf = buf;
|
chip->buf = buf;
|
||||||
chip->dma_risc = dma;
|
chip->dma_risc = dma;
|
||||||
|
|
||||||
substream->runtime->dma_area = chip->dma_risc->vmalloc;
|
substream->runtime->dma_area = chip->dma_risc->vaddr;
|
||||||
substream->runtime->dma_bytes = chip->dma_size;
|
substream->runtime->dma_bytes = chip->dma_size;
|
||||||
substream->runtime->dma_addr = 0;
|
substream->runtime->dma_addr = 0;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -669,7 +669,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
|
||||||
byte, but it doesn't work. So I allocate the DMA using the
|
byte, but it doesn't work. So I allocate the DMA using the
|
||||||
V4L functions, and force ALSA to use that as the DMA area */
|
V4L functions, and force ALSA to use that as the DMA area */
|
||||||
|
|
||||||
substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
|
substream->runtime->dma_area = dev->dmasound.dma.vaddr;
|
||||||
substream->runtime->dma_bytes = dev->dmasound.bufsize;
|
substream->runtime->dma_bytes = dev->dmasound.bufsize;
|
||||||
substream->runtime->dma_addr = 0;
|
substream->runtime->dma_addr = 0;
|
||||||
|
|
||||||
|
|
|
@ -211,17 +211,17 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction,
|
||||||
dprintk(1, "init kernel [%d pages]\n", nr_pages);
|
dprintk(1, "init kernel [%d pages]\n", nr_pages);
|
||||||
|
|
||||||
dma->direction = direction;
|
dma->direction = direction;
|
||||||
dma->vmalloc = vmalloc_32(nr_pages << PAGE_SHIFT);
|
dma->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT);
|
||||||
if (NULL == dma->vmalloc) {
|
if (NULL == dma->vaddr) {
|
||||||
dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
|
dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintk(1, "vmalloc is at addr 0x%08lx, size=%d\n",
|
dprintk(1, "vmalloc is at addr 0x%08lx, size=%d\n",
|
||||||
(unsigned long)dma->vmalloc,
|
(unsigned long)dma->vaddr,
|
||||||
nr_pages << PAGE_SHIFT);
|
nr_pages << PAGE_SHIFT);
|
||||||
|
|
||||||
memset(dma->vmalloc, 0, nr_pages << PAGE_SHIFT);
|
memset(dma->vaddr, 0, nr_pages << PAGE_SHIFT);
|
||||||
dma->nr_pages = nr_pages;
|
dma->nr_pages = nr_pages;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -254,8 +254,8 @@ int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
|
||||||
dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages,
|
dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages,
|
||||||
dma->offset);
|
dma->offset);
|
||||||
}
|
}
|
||||||
if (dma->vmalloc) {
|
if (dma->vaddr) {
|
||||||
dma->sglist = videobuf_vmalloc_to_sg(dma->vmalloc,
|
dma->sglist = videobuf_vmalloc_to_sg(dma->vaddr,
|
||||||
dma->nr_pages);
|
dma->nr_pages);
|
||||||
}
|
}
|
||||||
if (dma->bus_addr) {
|
if (dma->bus_addr) {
|
||||||
|
@ -319,8 +319,8 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
|
||||||
dma->pages = NULL;
|
dma->pages = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfree(dma->vmalloc);
|
vfree(dma->vaddr);
|
||||||
dma->vmalloc = NULL;
|
dma->vaddr = NULL;
|
||||||
|
|
||||||
if (dma->bus_addr)
|
if (dma->bus_addr)
|
||||||
dma->bus_addr = 0;
|
dma->bus_addr = 0;
|
||||||
|
@ -444,7 +444,7 @@ static void *__videobuf_to_vaddr(struct videobuf_buffer *buf)
|
||||||
|
|
||||||
MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);
|
MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);
|
||||||
|
|
||||||
return mem->dma.vmalloc;
|
return mem->dma.vaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __videobuf_iolock(struct videobuf_queue *q,
|
static int __videobuf_iolock(struct videobuf_queue *q,
|
||||||
|
|
|
@ -102,10 +102,10 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
|
||||||
called with IRQ's disabled
|
called with IRQ's disabled
|
||||||
*/
|
*/
|
||||||
dprintk(1, "%s: buf[%d] freeing (%p)\n",
|
dprintk(1, "%s: buf[%d] freeing (%p)\n",
|
||||||
__func__, i, mem->vmalloc);
|
__func__, i, mem->vaddr);
|
||||||
|
|
||||||
vfree(mem->vmalloc);
|
vfree(mem->vaddr);
|
||||||
mem->vmalloc = NULL;
|
mem->vaddr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
q->bufs[i]->map = NULL;
|
q->bufs[i]->map = NULL;
|
||||||
|
@ -170,7 +170,7 @@ static int __videobuf_iolock(struct videobuf_queue *q,
|
||||||
dprintk(1, "%s memory method MMAP\n", __func__);
|
dprintk(1, "%s memory method MMAP\n", __func__);
|
||||||
|
|
||||||
/* All handling should be done by __videobuf_mmap_mapper() */
|
/* All handling should be done by __videobuf_mmap_mapper() */
|
||||||
if (!mem->vmalloc) {
|
if (!mem->vaddr) {
|
||||||
printk(KERN_ERR "memory is not alloced/mmapped.\n");
|
printk(KERN_ERR "memory is not alloced/mmapped.\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -189,13 +189,13 @@ static int __videobuf_iolock(struct videobuf_queue *q,
|
||||||
* read() method.
|
* read() method.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mem->vmalloc = vmalloc_user(pages);
|
mem->vaddr = vmalloc_user(pages);
|
||||||
if (!mem->vmalloc) {
|
if (!mem->vaddr) {
|
||||||
printk(KERN_ERR "vmalloc (%d pages) failed\n", pages);
|
printk(KERN_ERR "vmalloc (%d pages) failed\n", pages);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
dprintk(1, "vmalloc is at addr %p (%d pages)\n",
|
dprintk(1, "vmalloc is at addr %p (%d pages)\n",
|
||||||
mem->vmalloc, pages);
|
mem->vaddr, pages);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -254,18 +254,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
|
||||||
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
|
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
|
||||||
|
|
||||||
pages = PAGE_ALIGN(vma->vm_end - vma->vm_start);
|
pages = PAGE_ALIGN(vma->vm_end - vma->vm_start);
|
||||||
mem->vmalloc = vmalloc_user(pages);
|
mem->vaddr = vmalloc_user(pages);
|
||||||
if (!mem->vmalloc) {
|
if (!mem->vaddr) {
|
||||||
printk(KERN_ERR "vmalloc (%d pages) failed\n", pages);
|
printk(KERN_ERR "vmalloc (%d pages) failed\n", pages);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vmalloc, pages);
|
dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vaddr, pages);
|
||||||
|
|
||||||
/* Try to remap memory */
|
/* Try to remap memory */
|
||||||
retval = remap_vmalloc_range(vma, mem->vmalloc, 0);
|
retval = remap_vmalloc_range(vma, mem->vaddr, 0);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
printk(KERN_ERR "mmap: remap failed with error %d. ", retval);
|
printk(KERN_ERR "mmap: remap failed with error %d. ", retval);
|
||||||
vfree(mem->vmalloc);
|
vfree(mem->vaddr);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void *videobuf_to_vmalloc(struct videobuf_buffer *buf)
|
||||||
BUG_ON(!mem);
|
BUG_ON(!mem);
|
||||||
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
|
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
|
||||||
|
|
||||||
return mem->vmalloc;
|
return mem->vaddr;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(videobuf_to_vmalloc);
|
EXPORT_SYMBOL_GPL(videobuf_to_vmalloc);
|
||||||
|
|
||||||
|
@ -339,8 +339,8 @@ void videobuf_vmalloc_free(struct videobuf_buffer *buf)
|
||||||
|
|
||||||
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
|
MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM);
|
||||||
|
|
||||||
vfree(mem->vmalloc);
|
vfree(mem->vaddr);
|
||||||
mem->vmalloc = NULL;
|
mem->vaddr = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,7 +492,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
|
||||||
chip->buf = buf;
|
chip->buf = buf;
|
||||||
chip->dma_risc = dma;
|
chip->dma_risc = dma;
|
||||||
|
|
||||||
substream->runtime->dma_area = chip->dma_risc->vmalloc;
|
substream->runtime->dma_area = chip->dma_risc->vaddr;
|
||||||
substream->runtime->dma_bytes = chip->dma_size;
|
substream->runtime->dma_bytes = chip->dma_size;
|
||||||
substream->runtime->dma_addr = 0;
|
substream->runtime->dma_addr = 0;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct videobuf_dmabuf {
|
||||||
struct page **pages;
|
struct page **pages;
|
||||||
|
|
||||||
/* for kernel buffers */
|
/* for kernel buffers */
|
||||||
void *vmalloc;
|
void *vaddr;
|
||||||
|
|
||||||
/* for overlay buffers (pci-pci dma) */
|
/* for overlay buffers (pci-pci dma) */
|
||||||
dma_addr_t bus_addr;
|
dma_addr_t bus_addr;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
struct videobuf_vmalloc_memory {
|
struct videobuf_vmalloc_memory {
|
||||||
u32 magic;
|
u32 magic;
|
||||||
|
|
||||||
void *vmalloc;
|
void *vaddr;
|
||||||
|
|
||||||
/* remap_vmalloc_range seems to need to run
|
/* remap_vmalloc_range seems to need to run
|
||||||
* after mmap() on some cases */
|
* after mmap() on some cases */
|
||||||
|
|
Loading…
Reference in a new issue