diff options
author | Christoph Hellwig <hch@lst.de> | 2018-12-25 17:44:19 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-01-04 09:03:16 +0100 |
commit | d7076f07840851bbe57cb21ba052d6a4a9b1efa9 (patch) | |
tree | 2cebc6f27705cdc0049be2489a7ff353f096b9f7 /kernel/dma | |
parent | 2e05ea5cdc1ac55d9ef678ed5ea6c38acf7fd2a3 (diff) | |
download | linux-d7076f07840851bbe57cb21ba052d6a4a9b1efa9.tar.bz2 |
dma-mapping: implement dmam_alloc_coherent using dmam_alloc_attrs
dmam_alloc_coherent is just the default no-flags case of
dmam_alloc_attrs, so take advantage of this similar to the non-managed
version.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma')
-rw-r--r-- | kernel/dma/mapping.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index d7c34d2d1ba5..f00544cda4e9 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -46,45 +46,6 @@ static int dmam_match(struct device *dev, void *res, void *match_data) } /** - * dmam_alloc_coherent - Managed dma_alloc_coherent() - * @dev: Device to allocate coherent memory for - * @size: Size of allocation - * @dma_handle: Out argument for allocated DMA handle - * @gfp: Allocation flags - * - * Managed dma_alloc_coherent(). Memory allocated using this function - * will be automatically released on driver detach. - * - * RETURNS: - * Pointer to allocated memory on success, NULL on failure. - */ -void *dmam_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp) -{ - struct dma_devres *dr; - void *vaddr; - - dr = devres_alloc(dmam_release, sizeof(*dr), gfp); - if (!dr) - return NULL; - - vaddr = dma_alloc_coherent(dev, size, dma_handle, gfp); - if (!vaddr) { - devres_free(dr); - return NULL; - } - - dr->vaddr = vaddr; - dr->dma_handle = *dma_handle; - dr->size = size; - - devres_add(dev, dr); - - return vaddr; -} -EXPORT_SYMBOL(dmam_alloc_coherent); - -/** * dmam_free_coherent - Managed dma_free_coherent() * @dev: Device to free coherent memory for * @size: Size of allocation |