dmam_alloc_coherent is just the default no-flags case of dmam_alloc_attrs, so take advantage of this similar to the non-managed version.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -677,21 +677,20 @@ dma_mark_declared_memory_occupied(struct device *dev, · 676 unmodified lines | |||
| 677 | * Managed DMA API | 677 | * Managed DMA API |
| 678 | */ | 678 | */ |
| 679 | #ifdef CONFIG_HAS_DMA | 679 | #ifdef CONFIG_HAS_DMA |
| 680 | extern void *dmam_alloc_coherent(struct device *dev, size_t size, | 680 | extern void *dmam_alloc_attrs(struct device *dev, size_t size, |
| 681 | dma_addr_t *dma_handle, gfp_t gfp); | 681 | dma_addr_t *dma_handle, gfp_t gfp, |
| 682 | unsigned long attrs); | ||
| 682 | extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr, | 683 | extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr, |
| 683 | dma_addr_t dma_handle); | 684 | dma_addr_t dma_handle); |
| 684 | #else /* !CONFIG_HAS_DMA */ | 685 | #else /* !CONFIG_HAS_DMA */ |
| 685 | static inline void *dmam_alloc_coherent(struct device *dev, size_t size, | 686 | static inline void *dmam_alloc_attrs(struct device *dev, size_t size, |
| 686 | dma_addr_t *dma_handle, gfp_t gfp) | 687 | dma_addr_t *dma_handle, gfp_t gfp, |
| 688 | unsigned long attrs) | ||
| 687 | { return NULL; } | 689 | { return NULL; } |
| 688 | static inline void dmam_free_coherent(struct device *dev, size_t size, | 690 | static inline void dmam_free_coherent(struct device *dev, size_t size, |
| 689 | void *vaddr, dma_addr_t dma_handle) { } | 691 | void *vaddr, dma_addr_t dma_handle) { } |
| 690 | #endif /* !CONFIG_HAS_DMA */ | 692 | #endif /* !CONFIG_HAS_DMA */ |
| 691 | 693 | ||
| 692 | extern void *dmam_alloc_attrs(struct device *dev, size_t size, | ||
| 693 | dma_addr_t *dma_handle, gfp_t gfp, | ||
| 694 | unsigned long attrs); | ||
| 695 | #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT | 694 | #ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT |
| 696 | extern int dmam_declare_coherent_memory(struct device *dev, | 695 | extern int dmam_declare_coherent_memory(struct device *dev, |
| 697 | phys_addr_t phys_addr, | 696 | phys_addr_t phys_addr, |
| @@ -711,6 +710,13 @@ static inline void dmam_release_declared_memory(struct device *dev) · 13 unmodified lines | |||
| 711 | } | 710 | } |
| 712 | #endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ | 711 | #endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ |
| 713 | 712 | ||
| 713 | static inline void *dmam_alloc_coherent(struct device *dev, size_t size, | ||
| 714 | dma_addr_t *dma_handle, gfp_t gfp) | ||
| 715 | { | ||
| 716 | return dmam_alloc_attrs(dev, size, dma_handle, gfp, | ||
| 717 | (gfp & __GFP_NOWARN) ? DMA_ATTR_NO_WARN : 0); | ||
| 718 | } | ||
| 719 | |||
| 714 | static inline void *dma_alloc_wc(struct device *dev, size_t size, | 720 | static inline void *dma_alloc_wc(struct device *dev, size_t size, |
| 715 | dma_addr_t *dma_addr, gfp_t gfp) | 721 | dma_addr_t *dma_addr, gfp_t gfp) |
| 716 | { | 722 | { |