swiotlb: refactor coherent buffer freeing
authorChristoph Hellwig <hch@lst.de>
Sat, 23 Dec 2017 19:56:02 +0000 (20:56 +0100)
committerChristoph Hellwig <hch@lst.de>
Mon, 15 Jan 2018 08:35:48 +0000 (09:35 +0100)
commita25381aa3ae60a2e028c95f1318649b13cbbce30
tree33eb75af3f080f6f1e6a8210c59731cd11243273
parentaaf796dc6e84e809e4c791b6517326b26312c972
swiotlb: refactor coherent buffer freeing

Factor out a new swiotlb_free_buffer helper that checks if an address
is allocated from the swiotlb bounce buffer, and if yes frees it.

This allows to simplify the swiotlb_free implemenation that uses
dma_direct_free to free the non-bounce buffer allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian König <christian.koenig@amd.com>
lib/swiotlb.c