diff options
Diffstat (limited to 'drivers/base/dma-buf.c')
-rw-r--r-- | drivers/base/dma-buf.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index 7cfb405b1ad5..d43d80256fda 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c | |||
@@ -468,3 +468,37 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma, | |||
468 | return dmabuf->ops->mmap(dmabuf, vma); | 468 | return dmabuf->ops->mmap(dmabuf, vma); |
469 | } | 469 | } |
470 | EXPORT_SYMBOL_GPL(dma_buf_mmap); | 470 | EXPORT_SYMBOL_GPL(dma_buf_mmap); |
471 | |||
472 | /** | ||
473 | * dma_buf_vmap - Create virtual mapping for the buffer object into kernel address space. Same restrictions as for vmap and friends apply. | ||
474 | * @dma_buf: [in] buffer to vmap | ||
475 | * | ||
476 | * This call may fail due to lack of virtual mapping address space. | ||
477 | * These calls are optional in drivers. The intended use for them | ||
478 | * is for mapping objects linear in kernel space for high use objects. | ||
479 | * Please attempt to use kmap/kunmap before thinking about these interfaces. | ||
480 | */ | ||
481 | void *dma_buf_vmap(struct dma_buf *dmabuf) | ||
482 | { | ||
483 | if (WARN_ON(!dmabuf)) | ||
484 | return NULL; | ||
485 | |||
486 | if (dmabuf->ops->vmap) | ||
487 | return dmabuf->ops->vmap(dmabuf); | ||
488 | return NULL; | ||
489 | } | ||
490 | EXPORT_SYMBOL_GPL(dma_buf_vmap); | ||
491 | |||
492 | /** | ||
493 | * dma_buf_vunmap - Unmap a vmap obtained by dma_buf_vmap. | ||
494 | * @dma_buf: [in] buffer to vmap | ||
495 | */ | ||
496 | void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) | ||
497 | { | ||
498 | if (WARN_ON(!dmabuf)) | ||
499 | return; | ||
500 | |||
501 | if (dmabuf->ops->vunmap) | ||
502 | dmabuf->ops->vunmap(dmabuf, vaddr); | ||
503 | } | ||
504 | EXPORT_SYMBOL_GPL(dma_buf_vunmap); | ||