[alsa-devel] [PATCH] ALSA: ASoC: move dma_data from snd_soc_dai to snd_soc_pcm_stream

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Mar 18 19:22:11 CET 2010


On Thu, Mar 18, 2010 at 07:08:59PM +0100, Daniel Mack wrote:
> This fixes a memory corruption when using ASoC devices are used in
> full-duplex mode. Specifically for pxa-ssp code, where this pointer
> is dynamically allocated for each direction and destroyed upon each
> stream start.

> All other platforms are fixed blindly, I couldn't even compile-test
> them. Sorry for any breakage I may have caused.

Looks good at first pass, though I think there's some more platforms
have been missed?  I'm just about to leave for today, Liam and I will
check properly tomorrow.  Thanks for diagnosing this!

> +static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
> +					     const struct snd_pcm_substream *ss)
> +{
> +	return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
> +		dai->playback.dma_data : dai->capture.dma_data;
> +}
> +
> +static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
> +					    const struct snd_pcm_substream *ss,
> +					    void *data)
> +{
> +	if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
> +		dai->playback.dma_data = data;
> +	else
> +		dai->capture.dma_data = data;
> +}

Make your mind up if you like the ternery operator :P


More information about the Alsa-devel mailing list