diff options
author | Takashi Iwai <tiwai@suse.de> | 2022-11-16 12:54:02 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2022-11-16 12:54:06 +0100 |
commit | d69d137e56304be744537fbb4ef9b0878fbc53d6 (patch) | |
tree | c9a765be8da60ae977c96f728a47cdbeda65b1a5 /sound/core/memalloc.c | |
parent | d59b6f215aa8bf52f36f72235752177fb79cf5b3 (diff) | |
parent | 1abfd71ee8f3ed99c5d0df5d9843a360541d6808 (diff) | |
download | linux-d69d137e56304be744537fbb4ef9b0878fbc53d6.tar.gz linux-d69d137e56304be744537fbb4ef9b0878fbc53d6.tar.bz2 linux-d69d137e56304be744537fbb4ef9b0878fbc53d6.zip |
Merge branch 'for-linus' into for-next
Back-merge of devel branch for further fixes of memalloc helpers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/memalloc.c')
-rw-r--r-- | sound/core/memalloc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 03cffe771366..ba095558b6d1 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -9,6 +9,7 @@ #include <linux/slab.h> #include <linux/mm.h> #include <linux/dma-mapping.h> +#include <linux/dma-map-ops.h> #include <linux/genalloc.h> #include <linux/highmem.h> #include <linux/vmalloc.h> @@ -543,17 +544,17 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir, DEFAULT_GFP, 0); - if (!sgt) { #ifdef CONFIG_SND_DMA_SGBUF + if (!sgt && !get_dma_ops(dmab->dev.dev)) { if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG) dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK; else dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK; return snd_dma_sg_fallback_alloc(dmab, size); -#else - return NULL; -#endif } +#endif + if (!sgt) + return NULL; dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, sg_dma_address(sgt->sgl)); @@ -857,7 +858,7 @@ static const struct snd_malloc_ops snd_dma_noncoherent_ops = { /* * Entry points */ -static const struct snd_malloc_ops *dma_ops[] = { +static const struct snd_malloc_ops *snd_dma_ops[] = { [SNDRV_DMA_TYPE_CONTINUOUS] = &snd_dma_continuous_ops, [SNDRV_DMA_TYPE_VMALLOC] = &snd_dma_vmalloc_ops, #ifdef CONFIG_HAS_DMA @@ -883,7 +884,7 @@ static const struct snd_malloc_ops *snd_dma_get_ops(struct snd_dma_buffer *dmab) if (WARN_ON_ONCE(!dmab)) return NULL; if (WARN_ON_ONCE(dmab->dev.type <= SNDRV_DMA_TYPE_UNKNOWN || - dmab->dev.type >= ARRAY_SIZE(dma_ops))) + dmab->dev.type >= ARRAY_SIZE(snd_dma_ops))) return NULL; - return dma_ops[dmab->dev.type]; + return snd_dma_ops[dmab->dev.type]; } |