iommu/dma: Apply dma_{alloc,free}_contiguous functions
Subsystems (2)
PATCH 1/1 iommu/dma: Apply dma_{alloc,free}_contiguous functions
This patch replaces dma_{alloc,release}_from_contiguous() with dma_{alloc,free}_contiguous() to simplify those function calls.
--- drivers/iommu/dma-iommu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/iommu/dma-iommu.c +4 -10
@@ -951,8 +951,8 @@ static void __iommu_dma_free(struct device *dev, size_t size, void *cpu_addr)if (pages)__iommu_dma_free_pages (pages, count); -if (page && !dma_release_from_contiguous (dev, page, count)) -__free_pages (page,get_order (alloc_size)); +if (page) +dma_free_contiguous (dev, page, alloc_size); } static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr,
@@ -970,12 +970,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,struct page *page =NULL ;void *cpu_addr; -if (gfpflags_allow_blocking (gfp)) - page =dma_alloc_from_contiguous (dev, alloc_size >>PAGE_SHIFT , -get_order (alloc_size), - gfp & __GFP_NOWARN); -if (!page) - page =alloc_pages (gfp,get_order (alloc_size)); + page =dma_alloc_contiguous (dev, alloc_size, gfp);if (!page)return NULL ;
@@ -997,8 +992,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,memset (cpu_addr,0 , alloc_size);return cpu_addr; out_free_pages: -if (!dma_release_from_contiguous (dev, page, alloc_size >>PAGE_SHIFT )) -__free_pages (page,get_order (alloc_size)); +dma_free_contiguous (dev, page, alloc_size);return NULL ; }
Signature · 1 line
2.17.1
Looks fine to me. Robin, any comments?
Quoted 49 lines · Nicolin Chen
This patch replaces dma_{alloc,release}_from_contiguous() with dma_{alloc,free}_contiguous() to simplify those function calls.
Signed-off-by Nicolin Chen <[email protected]>--- drivers/iommu/dma-iommu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/iommu/dma-iommu.c +4
-10@@ -951,8 +951,8 @@ static void __iommu_dma_free(struct device *dev, size_t size, void *cpu_addr)if (pages)__iommu_dma_free_pages (pages, count); -if (page && !dma_release_from_contiguous (dev, page, count)) -__free_pages (page,get_order (alloc_size)); +if (page) +dma_free_contiguous (dev, page, alloc_size); } static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr,@@ -970,12 +970,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,struct page *page =NULL ;void *cpu_addr; -if (gfpflags_allow_blocking (gfp)) - page =dma_alloc_from_contiguous (dev, alloc_size >>PAGE_SHIFT , -get_order (alloc_size), - gfp & __GFP_NOWARN); -if (!page) - page =alloc_pages (gfp,get_order (alloc_size)); + page =dma_alloc_contiguous (dev, alloc_size, gfp);if (!page)return NULL ;@@ -997,8 +992,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,memset (cpu_addr,0 , alloc_size);return cpu_addr; out_free_pages: -if (!dma_release_from_contiguous (dev, page, alloc_size >>PAGE_SHIFT )) -__free_pages (page,get_order (alloc_size)); +dma_free_contiguous (dev, page, alloc_size);return NULL ; }Signature · 1 line
2.17.1
---end quoted text---
Quoted 1 line · Christoph Hellwig
Looks fine to me. Robin, any comments?
AFAICS this looks like the obvious conversion, so... no? :)
Quoted 3 lines · Nicolin Chen
Quoted 2 lines
This patch replaces dma_{alloc,release}_from_contiguous() with dma_{alloc,free}_contiguous() to simplify those function calls.
Quoted 44 lines
Quoted 44 lines
Signed-off-by Nicolin Chen <[email protected]>--- drivers/iommu/dma-iommu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)drivers/iommu/dma-iommu.c +4
-10@@ -951,8 +951,8 @@ static void __iommu_dma_free(struct device *dev, size_t size, void *cpu_addr)if (pages)__iommu_dma_free_pages (pages, count); -if (page && !dma_release_from_contiguous (dev, page, count)) -__free_pages (page,get_order (alloc_size)); +if (page) +dma_free_contiguous (dev, page, alloc_size); } static void iommu_dma_free(struct device *dev, size_t size, void *cpu_addr,@@ -970,12 +970,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,struct page *page =NULL ;void *cpu_addr; -if (gfpflags_allow_blocking (gfp)) - page =dma_alloc_from_contiguous (dev, alloc_size >>PAGE_SHIFT , -get_order (alloc_size), - gfp & __GFP_NOWARN); -if (!page) - page =alloc_pages (gfp,get_order (alloc_size)); + page =dma_alloc_contiguous (dev, alloc_size, gfp);if (!page)return NULL ;@@ -997,8 +992,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,memset (cpu_addr,0 , alloc_size);return cpu_addr; out_free_pages: -if (!dma_release_from_contiguous (dev, page, alloc_size >>PAGE_SHIFT )) -__free_pages (page,get_order (alloc_size)); +dma_free_contiguous (dev, page, alloc_size);return NULL ; }
Quoted 4 lines
Quoted 2 lines
Signature · 1 line
2.17.1---end quoted text---
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 4 lines · Robin Murphy
Quoted 1 line · Christoph Hellwig
Looks fine to me. Robin, any comments?
AFAICS this looks like the obvious conversion, so... no? :)
Yep. Just want to make sure I don't apply dma-iommu patches without your review.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Christoph Hellwig
AppliedThanks,
applied to the dma-mapping for-next branch.