Files
linux-nvgpu/drivers/gpu/nvgpu/os/linux/linux-dma.c
Nicolin Chen ac3c3e2b69 gpu: nvgpu: Simplify nvgpu_dma_free_sys()
The original free routine has three options:
    if (NVGPU_DMA_NO_KERNEL_MAPPING)
        dma_free_attrs(d, mem->aligned_size, mem->priv.pages,
    else if (other flags)
        dma_free_attrs(d, mem->aligned_size, mem->cpu_va,
    else /* No flags */
        dma_free_coherent(d, mem->aligned_size, mem->cpu_va,

The last dma_free_coherent() can be unwrapped to dma_free_attrs
with its dma_attrs=0, while the former two are identical except
cpu_addr. So this patch merges these three into one single call
but differentiate the cpu_addr and dma_attrs parameters.

Note that the dma_free_attrs returns 0 when flags is not set.

Bug 200444660

Change-Id: I92ec0390138c79c5109973e476ea0ea719d4e2b9
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2029679
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-14 03:38:08 -07:00

12 KiB