diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-07-21 18:11:07 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-21 18:08:53 +0100 |
commit | b97e26980f6c13afad4c249b60a8dca7f5f86116 (patch) | |
tree | c079016bcd47d554f55e50b8ad3dc8aef34a1090 /sound/soc/soc-topology.c | |
parent | 62d8f23795aec9e8db2529a8ce2be638b9ab4c18 (diff) |
ASoC: dapm: Add helper function to free a widget
snd_soc_tplg_widget_remove_all() has a verbatim copy of an older version of
the widget freeing code from dapm_free_widgets(). Add a new helper function
that takes care of freeing a widget and use it in both places.
This removes the duplicated code and also makes sure that future changes to
the widget freeing code only have to be made in one location.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-topology.c')
-rw-r--r-- | sound/soc/soc-topology.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index d0960683c409..56dd108d6f5f 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1734,7 +1734,6 @@ void snd_soc_tplg_widget_remove_all(struct snd_soc_dapm_context *dapm, u32 index) { struct snd_soc_dapm_widget *w, *next_w; - struct snd_soc_dapm_path *p, *next_p; list_for_each_entry_safe(w, next_w, &dapm->card->widgets, list) { @@ -1746,31 +1745,9 @@ void snd_soc_tplg_widget_remove_all(struct snd_soc_dapm_context *dapm, if (w->dobj.index != index && w->dobj.index != SND_SOC_TPLG_INDEX_ALL) continue; - - list_del(&w->list); - - /* - * remove source and sink paths associated to this widget. - * While removing the path, remove reference to it from both - * source and sink widgets so that path is removed only once. - */ - list_for_each_entry_safe(p, next_p, &w->sources, list_sink) { - list_del(&p->list_sink); - list_del(&p->list_source); - list_del(&p->list); - kfree(p); - } - list_for_each_entry_safe(p, next_p, &w->sinks, list_source) { - list_del(&p->list_sink); - list_del(&p->list_source); - list_del(&p->list); - kfree(p); - } /* check and free and dynamic widget kcontrols */ snd_soc_tplg_widget_remove(w); - kfree(w->kcontrols); - kfree(w->name); - kfree(w); + snd_soc_dapm_free_widget(w); } } EXPORT_SYMBOL_GPL(snd_soc_tplg_widget_remove_all); |