diff options
author | Christoph Hellwig <hch@lst.de> | 2018-09-24 07:06:58 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-10-09 09:08:26 -0400 |
commit | 7ed1d91a9ed61afe438ba51cbf49cb567ab7dca8 (patch) | |
tree | e52c872dd4a8636d23d8b84b568463dd99b4b4ab | |
parent | 79ac32a427f5d1211fa417021fd04c36f63ab917 (diff) |
dma-mapping: translate __GFP_NOFAIL to DMA_ATTR_NO_WARN
This allows all dma_map_ops instances to entirely rely on
DMA_ATTR_NO_WARN going forward.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Robin Murphy <robin.murphy@arm.com>
-rw-r--r-- | include/linux/dma-mapping.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 547a48bcfa3d..15bd41447025 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -558,9 +558,11 @@ static inline void dma_free_attrs(struct device *dev, size_t size, | |||
558 | } | 558 | } |
559 | 559 | ||
560 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, | 560 | static inline void *dma_alloc_coherent(struct device *dev, size_t size, |
561 | dma_addr_t *dma_handle, gfp_t flag) | 561 | dma_addr_t *dma_handle, gfp_t gfp) |
562 | { | 562 | { |
563 | return dma_alloc_attrs(dev, size, dma_handle, flag, 0); | 563 | |
564 | return dma_alloc_attrs(dev, size, dma_handle, gfp, | ||
565 | (gfp & __GFP_NOWARN) ? DMA_ATTR_NO_WARN : 0); | ||
564 | } | 566 | } |
565 | 567 | ||
566 | static inline void dma_free_coherent(struct device *dev, size_t size, | 568 | static inline void dma_free_coherent(struct device *dev, size_t size, |
@@ -794,8 +796,12 @@ static inline void dmam_release_declared_memory(struct device *dev) | |||
794 | static inline void *dma_alloc_wc(struct device *dev, size_t size, | 796 | static inline void *dma_alloc_wc(struct device *dev, size_t size, |
795 | dma_addr_t *dma_addr, gfp_t gfp) | 797 | dma_addr_t *dma_addr, gfp_t gfp) |
796 | { | 798 | { |
797 | return dma_alloc_attrs(dev, size, dma_addr, gfp, | 799 | unsigned long attrs = DMA_ATTR_NO_WARN; |
798 | DMA_ATTR_WRITE_COMBINE); | 800 | |
801 | if (gfp & __GFP_NOWARN) | ||
802 | attrs |= DMA_ATTR_NO_WARN; | ||
803 | |||
804 | return dma_alloc_attrs(dev, size, dma_addr, gfp, attrs); | ||
799 | } | 805 | } |
800 | #ifndef dma_alloc_writecombine | 806 | #ifndef dma_alloc_writecombine |
801 | #define dma_alloc_writecombine dma_alloc_wc | 807 | #define dma_alloc_writecombine dma_alloc_wc |