参照元

説明

引数

返り値

参考

実装

/**
 * dmam_alloc_non_coherent - Managed dma_alloc_non_coherent()
 * @dev: Device to allocate non_coherent memory for
 * @size: Size of allocation
 * @dma_handle: Out argument for allocated DMA handle
 * @gfp: Allocation flags
 *
 * Managed dma_alloc_non_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_noncoherent(struct device *dev, size_t size,
                             dma_addr_t *dma_handle, gfp_t gfp)
{
        struct dma_devres *dr;
        void *vaddr;
        dr = devres_alloc(dmam_noncoherent_release, sizeof(*dr), gfp);
        if (!dr)
                return NULL;
        vaddr = dma_alloc_noncoherent(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_noncoherent);

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-03-15 (火) 10:18:21