diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-07-20 15:01:10 +0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-20 21:22:00 +0200 |
commit | b6d4f7e3ef25beb8c658c97867d98883e69dc544 (patch) | |
tree | b89a6c5588cae046ab9e007e22354ebdacb9318a /kernel/dma-coherent.c | |
parent | 8fa8b9fbab90c74139e8e868fe5b30b6a9f6be65 (diff) | |
download | linux-b6d4f7e3ef25beb8c658c97867d98883e69dc544.tar.gz linux-b6d4f7e3ef25beb8c658c97867d98883e69dc544.tar.bz2 linux-b6d4f7e3ef25beb8c658c97867d98883e69dc544.zip |
dma-coherent: add documentation to new interfaces
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/dma-coherent.c')
-rw-r--r-- | kernel/dma-coherent.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c index 56dff5cb0f29..7517115a8cce 100644 --- a/kernel/dma-coherent.c +++ b/kernel/dma-coherent.c @@ -92,6 +92,21 @@ void *dma_mark_declared_memory_occupied(struct device *dev, } EXPORT_SYMBOL(dma_mark_declared_memory_occupied); +/** + * Try to allocate memory from the per-device coherent area. + * + * @dev: device from which we allocate memory + * @size: size of requested memory area + * @dma_handle: This will be filled with the correct dma handle + * @ret: This pointer will be filled with the virtual address + * to allocated area. + * + * This function should be only called from per-arch %dma_alloc_coherent() + * to support allocation from per-device coherent memory pools. + * + * Returns 0 if dma_alloc_coherent should continue with allocating from + * generic memory areas, or !0 if dma_alloc_coherent should return %ret. + */ int dma_alloc_from_coherent(struct device *dev, ssize_t size, dma_addr_t *dma_handle, void **ret) { @@ -111,6 +126,19 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size, return (mem != NULL); } +/** + * Try to free the memory allocated from per-device coherent memory pool. + * @dev: device from which the memory was allocated + * @order: the order of pages allocated + * @vaddr: virtual address of allocated pages + * + * This checks whether the memory was allocated from the per-device + * coherent memory pool and if so, releases that memory. + * + * Returns 1 if we correctly released the memory, or 0 if + * %dma_release_coherent() should proceed with releasing memory from + * generic pools. + */ int dma_release_from_coherent(struct device *dev, int order, void *vaddr) { struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; |