Re: ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_*

From: youling 257
Date: Mon Nov 04 2019 - 03:27:25 EST


This driver https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/drivers/usb/gadget/function/f_audio_source.c

2019-11-04 16:02 GMT+08:00, Takashi Iwai <tiwai@xxxxxxx>:

> Exactly which driver is hit? The code path is via hw_support_mmap()
> and it's currently:
>
> static bool hw_support_mmap(struct snd_pcm_substream *substream)
> {
> if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP))
> return false;
>
> if (substream->ops->mmap ||
> substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV)
> return true;
>
> return dma_can_mmap(substream->dma_buffer.dev.dev);
> }
>
> so at least the driver has already set the SNDRV_DMA_TYPE_DEV
> explicitly (it's non-zero) and some device object, but the device
> object was invalid for dma_can_mmap() call.
>
> This smells more like a driver-side issue, not in the core side.
>
>
> thanks,
>
> Takashi
>