Skip to contentSkip to conversation

ASoC: core: lock client_mutex while removing link components

PATCH In review Ranjani Sridharan 2 participants 2 messages May 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: core: lock client_mutex while removing link components

Removing link components results in topology unloading. So, acquire the client_mutex before removing components in soc_remove_link_components. This will prevent the lockdep warning seen when dai links are removed during topology removal.

---
 sound/soc/soc-core.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/soc-core.c +2 -0
index ce8c057bcd5b..bbb52fbd195e 100644
@@ -1010,12 +1010,14 @@ static void soc_remove_link_components(struct snd_soc_card *card,
 	struct snd_soc_component *component;
 	struct snd_soc_rtdcom_list *rtdcom;
 
+	mutex_lock(&client_mutex);
 	for_each_rtdcom(rtd, rtdcom) {
 		component = rtdcom->component;
 
 		if (component->driver->remove_order == order)
 			soc_remove_component(component);
 	}
+	mutex_unlock(&client_mutex);
 }
 
 static void soc_remove_dai_links(struct snd_soc_card *card)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Ranjani Sridharan

Removing link components results in topology unloading. So, acquire the client_mutex before removing components in soc_remove_link_components. This will prevent the lockdep warning seen when dai links are removed during topology removal.

GitHub issue: https://github.com/thesofproject/linux/issues/967 for more details.

Quoted 24 lines
---
  sound/soc/soc-core.c | 2 ++
  1 file changed, 2 insertions(+)
sound/soc/soc-core.c +2 -0
index ce8c057bcd5b..bbb52fbd195e 100644
@@ -1010,12 +1010,14 @@ static void soc_remove_link_components(struct snd_soc_card *card,
  	struct snd_soc_component *component;
  	struct snd_soc_rtdcom_list *rtdcom;
 
+	mutex_lock(&client_mutex);
  	for_each_rtdcom(rtd, rtdcom) {
  		component = rtdcom->component;
 
  		if (component->driver->remove_order == order)
  			soc_remove_component(component);
  	}
+	mutex_unlock(&client_mutex);
  }
 
  static void soc_remove_dai_links(struct snd_soc_card *card)