Hi Takashi
Thank you for your feedback
Why .name is needed ??
AFAIK, the binding with aux_dev->name was introduced later as a fallback in case of no codec. Through a quick glance at git log, the commit f2ed6b07645e brought the behavior. Other than that, the field was used merely for some label, e.g. passed to snd_soc_post_component_init().
Ahh, OK. for non codec... Then, the reason was "main" is for search for codec, and it is using "codec_xxx" variable name. Then, using .name and .codec_name/.codec_of_node in the same time is strange.
Anyway, the purpose of these are for finding component. I think this complicated code can be simple if we could replace it to snd_soc_dai_link_component which exist for this purpose ?
struct snd_soc_aux_dev { - const char *name; /* Codec name */
/* * specify multi-codec either by device name, or by * DT/OF node, but not both. */ - const char *codec_name; - struct device_node *codec_of_node; + struct snd_soc_dai_link_component dlc; + /* codec/machine specific init - e.g. add machine controls */ int (*init)(struct snd_soc_component *component); };