From abe594c2cf55b46d4feb61c01fe9063afff2e50c Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 9 Jul 2017 21:31:02 +0200 Subject: ALSA: pcm: Protect call to dma_mmap_coherent() by check for HAS_DMA If NO_DMA=y: sound/core/pcm_native.o: In function `snd_pcm_lib_default_mmap': pcm_native.c:(.text+0x144c): undefined reference to `bad_dma_ops' pcm_native.c:(.text+0x1474): undefined reference to `dma_common_mmap' Add a check for HAS_DMA to fix this. Signed-off-by: Geert Uytterhoeven Signed-off-by: Takashi Iwai --- sound/core/pcm_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/core') diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 0d1834310531..b26c7e61d600 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3502,7 +3502,7 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, } #endif /* CONFIG_GENERIC_ALLOCATOR */ #ifndef CONFIG_X86 /* for avoiding warnings arch/x86/mm/pat.c */ - if (!substream->ops->page && + if (IS_ENABLED(CONFIG_HAS_DMA) && !substream->ops->page && substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) return dma_mmap_coherent(substream->dma_buffer.dev.dev, area, -- cgit v1.2.3 From 85dc0f8554fa024b02eb50dcca71fa9881a45ea5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 10 Jul 2017 16:05:58 +0200 Subject: ALSA: pcm: Simplify check for dma_mmap_coherent() availability We check the availability of dma_mmap_coherent() in hw_support_mmap() but with an ugly ifdef of lots of arch-checks. Now we have a nice CONFIG_ARCH_NO_COHERENT_DMA_MMAP kconfig, and this can be used together with CONFIG_HAS_DMA check for a cleaner and more comprehensive check. Signed-off-by: Takashi Iwai --- sound/core/pcm_native.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound/core') diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index b26c7e61d600..2a730f38e375 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -238,10 +238,8 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream) { if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP)) return false; - /* check architectures that return -EINVAL from dma_mmap_coherent() */ - /* FIXME: this should be some global flag */ -#if defined(CONFIG_C6X) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) ||\ - defined(CONFIG_PARISC) || defined(CONFIG_XTENSA) + /* architecture supports dma_mmap_coherent()? */ +#if defined(CONFIG_ARCH_NO_COHERENT_DMA_MMAP) || !defined(CONFIG_HAS_DMA) if (!substream->ops->mmap && substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) return false; -- cgit v1.2.3