Buffer ownership (CPU or device) matters only to decide who is allowed access to the contents of the buffer.
dma_unmap_single() does not care about the content; it can be called in any state.
Note that after decoupling the DMA, the memory again βbelongsβ to the CPU. If you perform only one DMA transfer, you do not need to call dma_sync_single_for_cpu() ; you can just read the buffer after calling dma_unmap_single() .
source share