dma-direct: drop two CONFIG_DMA_RESTRICTED_POOL conditionals
authorChristoph Hellwig <hch@lst.de>
Thu, 21 Oct 2021 07:34:59 +0000 (09:34 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 7 Dec 2021 11:50:10 +0000 (12:50 +0100)
swiotlb_alloc and swiotlb_free are properly stubbed out if
CONFIG_DMA_RESTRICTED_POOL is not set, so skip the extra checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
kernel/dma/direct.c

index 84226a764471bfd993446de0f2c12ae9f69b1118..cf75bfb2f499ef7da15cb3dfe9bdc1435e852112 100644 (file)
@@ -97,8 +97,7 @@ static int dma_set_encrypted(struct device *dev, void *vaddr, size_t size)
 static void __dma_direct_free_pages(struct device *dev, struct page *page,
                                    size_t size)
 {
-       if (IS_ENABLED(CONFIG_DMA_RESTRICTED_POOL) &&
-           swiotlb_free(dev, page, size))
+       if (swiotlb_free(dev, page, size))
                return;
        dma_free_contiguous(dev, page, size);
 }
@@ -114,8 +113,7 @@ static struct page *__dma_direct_alloc_pages(struct device *dev, size_t size,
 
        gfp |= dma_direct_optimal_gfp_mask(dev, dev->coherent_dma_mask,
                                           &phys_limit);
-       if (IS_ENABLED(CONFIG_DMA_RESTRICTED_POOL) &&
-           is_swiotlb_for_alloc(dev)) {
+       if (is_swiotlb_for_alloc(dev)) {
                page = swiotlb_alloc(dev, size);
                if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) {
                        __dma_direct_free_pages(dev, page, size);