On Tue, Dec 14, 2021 at 12:00 PM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> wrote: > Option 1. Machine driver makes sure the object is valid until registered > > This patch adopts the option. It needs snd_soc_register_card() to call > of_node_get() somewhere to hold the reference count of of_node. However, > I failed to find similar logic in soc-core.c. > > Option 2. Machine driver borrows the reference count > > This is what [1] adopts. Decreasing the reference count in device's > remove() to make sure the object is valid for whole sound card's lifecycle. > > [1]: https://elixir.bootlin.com/linux/v5.16-rc5/source/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c#L1065 I guess I have found the answer to my original questions. The of_node in snd_soc_dai_link_component in snd_soc_dai_link is mainly for matching the component[4]. snd_soc_component itself should hold the reference count. [4]: https://elixir.bootlin.com/linux/v5.16-rc6/source/sound/soc/soc-core.c#L749 In summary: - ASoC doesn't need to hold the device_node reference counts. - Device nodes can be released after components have bound.