ASoC: soc-dapm.c: clean up debugfs for freed widget
authorTrevor Wu <trevor.wu@mediatek.com>
Fri, 26 May 2023 09:31:48 +0000 (17:31 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 2 Jun 2023 12:29:09 +0000 (13:29 +0100)
commit8ad13cdc92f66333ae475251ae7722313f84e496
tree0b2cc619500e287d89dc7aa44fcd89518115f935
parentc0e7390e6d3f42b9a15a0e72add21facb8e17790
ASoC: soc-dapm.c: clean up debugfs for freed widget

When a widget is added to dapm via snd_soc_dapm_new_widgets,
dapm_debugfs_add_widget is also called to create a corresponding debugfs
file. However, when a widget is freed by snd_soc_dapm_free_widget, the
corresponding debugfs is not cleared. As a result, the freed widget is
still seen in the dapm directory.

This patch adds dapm_debugfs_free_widget to free the debugfs of a
specified widget, and it's called at snd_soc_dapm_free_widget to clean
up the debugfs for freed widget.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-6-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c