[alsa-devel] [PATCH] ASoC: Allocate PCM operations dynamically to support multiple DAIs

Lars-Peter Clausen lars at metafoo.de
Fri Dec 23 12:36:15 CET 2011


On 12/23/2011 01:26 AM, Sangbeom Kim wrote:
> From: Sangsu Park <sangsu4u.park at samsung.com>
> 
> The original code does not cover the case that two DAIs(CPU) have different
> ASoC core PCM operations(like mmap, pointer...). Currently we have only one
> global soc_pcm_ops for ASoC core PCM operation. When two DAIs have different
> pointer functions, second DAI's pointer function is set for both first DAI
> and second DAI in case of original code.
> 
> This patch allocates ASoC core PCM operations dynamically for each DAIs. So
> each DAIs can have different ASoC core PCM operations. This is needed to
> support multiple DAIs.
> 
> Signed-off-by: Sangsu Park <sangsu4u.park at samsung.com>
> Signed-off-by: Sangbeom Kim <sbkim73 at samsung.com>
> ---
>  sound/core/pcm.c    |    1 +
>  sound/soc/soc-pcm.c |   44 ++++++++++++++++++++++++--------------------
>  2 files changed, 25 insertions(+), 20 deletions(-)
> 
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 8928ca8..15cf27a 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -769,6 +769,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
>  		substream_next = substream->next;
>  		snd_pcm_timer_done(substream);
>  		snd_pcm_substream_proc_done(substream);
> +		kfree(substream->ops);

This looks wrong. It will probably cause regression for all non ASoC sound
card drivers.

The issue this patch addresses came up before and I think the conclusion was
that it is best to embed the snd_pcm_ops struct into the snd_soc_pcm_runtime
struct.


More information about the Alsa-devel mailing list