| .. | .. |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | static int __videobuf_dc_alloc(struct device *dev, |
|---|
| 38 | 38 | struct videobuf_dma_contig_memory *mem, |
|---|
| 39 | | - unsigned long size, gfp_t flags) |
|---|
| 39 | + unsigned long size) |
|---|
| 40 | 40 | { |
|---|
| 41 | 41 | mem->size = size; |
|---|
| 42 | | - mem->vaddr = dma_alloc_coherent(dev, mem->size, |
|---|
| 43 | | - &mem->dma_handle, flags); |
|---|
| 44 | | - |
|---|
| 42 | + mem->vaddr = dma_alloc_coherent(dev, mem->size, &mem->dma_handle, |
|---|
| 43 | + GFP_KERNEL); |
|---|
| 45 | 44 | if (!mem->vaddr) { |
|---|
| 46 | 45 | dev_err(dev, "memory alloc size %ld failed\n", mem->size); |
|---|
| 47 | 46 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 258 | 257 | return videobuf_dma_contig_user_get(mem, vb); |
|---|
| 259 | 258 | |
|---|
| 260 | 259 | /* allocate memory for the read() method */ |
|---|
| 261 | | - if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(vb->size), |
|---|
| 262 | | - GFP_KERNEL)) |
|---|
| 260 | + if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(vb->size))) |
|---|
| 263 | 261 | return -ENOMEM; |
|---|
| 264 | 262 | break; |
|---|
| 265 | 263 | case V4L2_MEMORY_OVERLAY: |
|---|
| .. | .. |
|---|
| 295 | 293 | BUG_ON(!mem); |
|---|
| 296 | 294 | MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); |
|---|
| 297 | 295 | |
|---|
| 298 | | - if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(buf->bsize), |
|---|
| 299 | | - GFP_KERNEL | __GFP_COMP)) |
|---|
| 296 | + if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(buf->bsize))) |
|---|
| 300 | 297 | goto error; |
|---|
| 301 | | - |
|---|
| 302 | | - /* Try to remap memory */ |
|---|
| 303 | | - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
|---|
| 304 | 298 | |
|---|
| 305 | 299 | /* the "vm_pgoff" is just used in v4l2 to find the |
|---|
| 306 | 300 | * corresponding buffer data structure which is allocated |
|---|
| 307 | 301 | * earlier and it does not mean the offset from the physical |
|---|
| 308 | 302 | * buffer start address as usual. So set it to 0 to pass |
|---|
| 309 | | - * the sanity check in vm_iomap_memory(). |
|---|
| 303 | + * the sanity check in dma_mmap_coherent(). |
|---|
| 310 | 304 | */ |
|---|
| 311 | 305 | vma->vm_pgoff = 0; |
|---|
| 312 | | - |
|---|
| 313 | | - retval = vm_iomap_memory(vma, mem->dma_handle, mem->size); |
|---|
| 306 | + retval = dma_mmap_coherent(q->dev, vma, mem->vaddr, mem->dma_handle, |
|---|
| 307 | + mem->size); |
|---|
| 314 | 308 | if (retval) { |
|---|
| 315 | 309 | dev_err(q->dev, "mmap: remap failed with error %d. ", |
|---|
| 316 | 310 | retval); |
|---|