[alsa-devel] [PATCH 15/15] ASoC: soc-core: add soc_unbind_aux_dev()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Aug 20 04:11:16 CEST 2019
Hi Sridharan
Thank you for your feedback
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
>
> It is easy to read code if it is cleanly using paired function/naming,
> like start <-> stop, register <-> unregister, etc, etc.
> But, current ALSA SoC code is very random, unbalance, not paired, etc.
> It is easy to create bug at the such code, and it will be difficult to
> debug.
>
> soc-core.c has soc_bind_aux_dev(), but, there is no its paired
> soc_unbind_aux_dev(). This patch adds it.
>
> Morimoto-san,
> I'm not sure it quite improves readability to just have list_del in unbind_aux_dev(). bin_aux_dev() does more than just
> adding to the card_aux_list(). So in fact, I think this change makes it look unbalanced.
Hmm...
But, bind_aux_dev() is doing
1) find target component
2) setup component->init
3) add card_aux_list
We can ignore 1) for unbind.
This patch is for 3).
I guess we can ignore 2), but can handle it.
How about this ?
static void soc_unbind_aux_dev(struct snd_soc_component *component)
{
=> component->init = NULL;
list_del(&component->card_aux_list);
}
> The existing code for aux_dev looks quite similar to what bind_dai_link() and remove_dai_link() do and they are quite
> intuitive.
I guess "add"_dai_link instead of "bind"_dai_link ?
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list