Skip to contentSkip to conversation

ASoC: dapm: Remove snd_soc_of_parse_audio_routing() due to deferred probe

PATCH In review Mark Brown 2 participants 4 messages Dec 18, 2014 – Dec 19, 2014

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 ASoC: dapm: Remove snd_soc_of_parse_audio_routing() due to deferred probe

This reverts commit f8781db8aeb18d (ASoC: dapm: Augment existing card DAPM routes in snd_soc_of_parse_audio_routing) since it is broken for deferred probing as it ends up storing data allocated with devm_ over multiple instantiations of the device.

---
 sound/soc/soc-core.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
sound/soc/soc-core.c +5 -9
index 935721062c21..d7595465cfbc 100644
@@ -3231,7 +3231,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname)
 {
 	struct device_node *np = card->dev->of_node;
-	int num_routes, old_routes;
+	int num_routes;
 	struct snd_soc_dapm_route *routes;
 	int i, ret;
 
@@ -3249,9 +3249,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 		return -EINVAL;
 	}
 
-	old_routes = card->num_dapm_routes;
-	routes = devm_kzalloc(card->dev,
-			      (old_routes + num_routes) * sizeof(*routes),
+	routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
 			      GFP_KERNEL);
 	if (!routes) {
 		dev_err(card->dev,
@@ -3259,11 +3257,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 		return -EINVAL;
 	}
 
-	memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
-
 	for (i = 0; i < num_routes; i++) {
 		ret = of_property_read_string_index(np, propname,
-			2 * i, &routes[old_routes + i].sink);
+			2 * i, &routes[i].sink);
 		if (ret) {
 			dev_err(card->dev,
 				"ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3271,7 +3267,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 			return -EINVAL;
 		}
 		ret = of_property_read_string_index(np, propname,
-			(2 * i) + 1, &routes[old_routes + i].source);
+			(2 * i) + 1, &routes[i].source);
 		if (ret) {
 			dev_err(card->dev,
 				"ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3280,7 +3276,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 		}
 	}
 
-	card->num_dapm_routes += num_routes;
+	card->num_dapm_routes = num_routes;
 	card->dapm_routes = routes;
 
 	return 0;
Signature · 1 line
2.1.3
#1 lore raw
Quoted 8 lines · Mark Brown

This reverts commit f8781db8aeb18d (ASoC: dapm: Augment existing card DAPM routes in snd_soc_of_parse_audio_routing) since it is broken for deferred probing as it ends up storing data allocated with devm_ over multiple instantiations of the device.

---

Thanks Mark - I'll add it for testing this evening. Please modify the
Reported-by: line to:

please, thanks.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
author maintainer
#2 lore raw
Quoted 6 lines · Russell King - ARM Linux

Thanks Mark - I'll add it for testing this evening. Please modify the
Reported-by: line to:

please, thanks.

Done.

Tested-by Russell King
#3 lore raw
Quoted 10 lines · Mark Brown
Quoted 6 lines · Russell King - ARM Linux

Thanks Mark - I'll add it for testing this evening. Please modify the
Reported-by: line to:

please, thanks.

Done.

Great news, the SDP4430 now boots again. Thanks for the fix, and Merry Christmas.

omap-abe-twl6040 sound: ASoC: CODEC DAI twl6040-legacy not registered omap-abe-twl6040 sound: snd_soc_register_card() failed: -517 platform sound: Driver omap-abe-twl6040 requests probe deferral
...
omap-abe-twl6040 sound: twl6040-legacy <-> 40132000.mcpdm mapping ok omap-abe-twl6040 sound: dmic-hifi <-> 4012e000.dmic mapping ok

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.