该函数只是一个简单的一个循环,为传入的widget模板数组依次调用snd_soc_dapm_new_control函数,实际的工作由snd_soc_dapm_new_control完成。 在驱动中定义的snd_soc_dapm_widget数组,只是作为一个模板,所以snd_soc_dapm_new_control所做的第一件事,就是为该widget重新分配内存,并把模板的内容拷贝过来 staticstructs...
staticintsdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd){structsnd_soc_codec*codec=rtd->codec;structsnd_soc_dapm_context*dapm= &codec->dapm;intret;/* Add SDP4430 specific widgets */ret =snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets, ARRAY_SIZE(sdp4430_twl6040_dap...