]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ASoC: core: remove link components before cleaning up card resources
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Fri, 5 Apr 2019 00:30:40 +0000 (17:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:43:37 +0000 (06:43 -0700)
commit34e3da15025a12ee1081d355dd4869b19c7ed253
tree0002a0de29a498c395983cc3a8cdf33cc937b5cb
parent18127d11a49815897d541a096b3ddbad4740905c
ASoC: core: remove link components before cleaning up card resources

[ Upstream commit f96fb7d198ca624fe33c4145a004eb5a3d0eddec ]

When the card is registered by the machine driver,
dai link components are probed after the snd_card is
created. This is done in snd_soc_bind_card() which calls
snd_soc_instantiate_card() to first create the snd_card
and then probes the link components by calling
soc_probe_link_components(). The snd_card is used by the
component driver to add the kcontrols associated
with dapm widgets to the card.

When the machine driver is unregistered, the snd_card
is freed when the card resources are cleaned up.
But the snd_card needs to be valid while unloading the
topology dapm widgets in order to remove the kcontrols
from the card.

Since, unloading topology is done when the component
driver is removed, the link components should be removed
in snd_soc_unbind_card(). This will ensure that the kcontrols
are removed before the card resources are cleaned up and
the snd_card itself is freed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/soc-core.c