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

Sangsu Park sangsu at gmail.com
Tue Dec 27 09:06:56 CET 2011


> 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.

Hi, I'm Sangsu Park. (sangsu4u.park at samsung.com)
I'm using gmail because of company's firewall problems...

I agree you, So I've changed some code like follows.
If you like that, I'll make patch version 2nd using that.

//------------------------------------------------------------------------------
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 42ad2db..d1468aa 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -918,6 +918,9 @@ static void soc_remove_dai_link(struct
snd_soc_card *card, int num, int order)
                list_del(&cpu_dai->card_list);
                module_put(cpu_dai->dev->driver->owner);
        }
+
+       /* free the ops memory */
+       if (rtd->ops) kfree(rtd->ops);
 }
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 8aa7cec..4eb793b 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -641,22 +645,23 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
        INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
        rtd->pcm = pcm;
+       rtd->ops = soc_pcm_ops;
        pcm->private_data = rtd;
        if (platform->driver->ops) {
------------------------------------------------------------------------------//

Thanks.


More information about the Alsa-devel mailing list