Skip to contentSkip to conversation

ASoC: Remove unused dapm_get_snd_card() and dapm_get_soc_card()

PATCH Applied Lars-Peter Clausen 4 participants 9 messages Jul 23, 2013 – Jul 24, 2013

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

PATCH 1/1 ASoC: Remove unused dapm_get_snd_card() and dapm_get_soc_card()

These two functions were added two years ago in commit 4805608 ("ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.") but have remained unused so far. Considering that the dapm context actually has a direct pointer to the card the functions also seem to be unnecessary. E.g. the expressions 'dapm_get_soc_card(dapm)' and 'dapm->card' yield the same result.

---
 sound/soc/soc-dapm.c | 30 ------------------------------
 1 file changed, 30 deletions(-)
sound/soc/soc-dapm.c +0 -30
index 346ac91..deb1b3d 100644
@@ -174,36 +174,6 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(
 	return kmemdup(_widget, sizeof(*_widget), GFP_KERNEL);
 }
 
-/* get snd_card from DAPM context */
-static inline struct snd_card *dapm_get_snd_card(
-	struct snd_soc_dapm_context *dapm)
-{
-	if (dapm->codec)
-		return dapm->codec->card->snd_card;
-	else if (dapm->platform)
-		return dapm->platform->card->snd_card;
-	else
-		BUG();
-
-	/* unreachable */
-	return NULL;
-}
-
-/* get soc_card from DAPM context */
-static inline struct snd_soc_card *dapm_get_soc_card(
-		struct snd_soc_dapm_context *dapm)
-{
-	if (dapm->codec)
-		return dapm->codec->card;
-	else if (dapm->platform)
-		return dapm->platform->card;
-	else
-		BUG();
-
-	/* unreachable */
-	return NULL;
-}
-
 static void dapm_reset(struct snd_soc_card *card)
 {
 	struct snd_soc_dapm_widget *w;
Signature · 1 line
1.8.0
#1 lore raw
Quoted 8 lines · Lars-Peter Clausen

These two functions were added two years ago in commit 4805608 ("ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.") but have remained unused so far. Considering that the dapm context actually has a direct pointer to the card the functions also seem to be unnecessary. E.g. the expressions 'dapm_get_soc_card(dapm)' and 'dapm->card' yield the same result.

---

Peter may have a user for these, but maybe not ?

Liam

maintainer
#2 lore raw
Quoted 8 lines · Liam Girdwood
Quoted 4 lines · Lars-Peter Clausen

Add methods to retrieve snd_card and soc_card from dapm context.") but have remained unused so far. Considering that the dapm context actually has a direct pointer to the card the functions also seem to be unnecessary. E.g. the expressions 'dapm_get_soc_card(dapm)' and 'dapm->card' yield the same result.

Peter may have a user for these, but maybe not ?

We can always add them back in later if they get a user.

#3 lore raw
Quoted 12 lines · Mark Brown
Quoted 8 lines · Liam Girdwood
Quoted 4 lines · Lars-Peter Clausen

Add methods to retrieve snd_card and soc_card from dapm context.") but have remained unused so far. Considering that the dapm context actually has a direct pointer to the card the functions also seem to be unnecessary. E.g. the expressions 'dapm_get_soc_card(dapm)' and 'dapm->card' yield the same result.

Peter may have a user for these, but maybe not ?

We can always add them back in later if they get a user.

If there are any out of tree users they should just use dapm->card instead. It's much more simpler than this 'if (dapm->codec) return dapm->codec->card; else if (dapm->platform) return dapm->platform->card;' and at the same time more robust since it also works for dapm contexts which don't belong to a codec or platform.

- Lars

maintainer
#4 lore raw
Quoted 10 lines · Lars-Peter Clausen
Quoted 1 line · Mark Brown

We can always add them back in later if they get a user.

If there are any out of tree users they should just use dapm->card instead. It's much more simpler than this 'if (dapm->codec) return dapm->codec->card; else if (dapm->platform) return dapm->platform->card;' and at the same time more robust since it also works for dapm contexts which don't belong to a codec or platform.

Right, though my thought looking at the code was that the intention was to also do a transition so that dapm->card isn't there any more.

#5 lore raw
Quoted 12 lines · Mark Brown
Quoted 10 lines · Lars-Peter Clausen
Quoted 1 line · Mark Brown

We can always add them back in later if they get a user.

If there are any out of tree users they should just use dapm->card instead. It's much more simpler than this 'if (dapm->codec) return dapm->codec->card; else if (dapm->platform) return dapm->platform->card;' and at the same time more robust since it also works for dapm contexts which don't belong to a codec or platform.

Quoted 2 lines

Right, though my thought looking at the code was that the intention was to also do a transition so that dapm->card isn't there any more.

In a sense the dapm context is like a common base class to both platforms and codecs. So it's probably better to remove 'card' from the codec and platform structs. codec->dapm.card is as expensive as codec->card while looking up the card for the dapm context by either going through the platform or codec is more expensive than using the direct pointer. But hopefully the component stuff will fix that all.

- Lars

maintainer
#6 lore raw
Quoted 7 lines · Lars-Peter Clausen
Quoted 2 lines · Mark Brown

Right, though my thought looking at the code was that the intention was to also do a transition so that dapm->card isn't there any more.

In a sense the dapm context is like a common base class to both platforms and codecs. So it's probably better to remove 'card' from

Yeah, I don't immediately see a way to go with the cleanup - that was just my reading of why you might want to push things in that direction.

#7 lore raw
In reply to Liam Girdwood
Quoted 11 lines · Liam Girdwood
Quoted 8 lines · Lars-Peter Clausen

These two functions were added two years ago in commit 4805608 ("ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.") but have remained unused so far. Considering that the dapm context actually has a direct pointer to the card the functions also seem to be unnecessary. E.g. the expressions 'dapm_get_soc_card(dapm)' and 'dapm->card' yield the same result.

---

Peter may have a user for these, but maybe not ?

No, I do not use these.

Signature · 5 lines
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer Applied
#8 lore raw
In reply to Lars-Peter Clausen
Quoted 5 lines · Lars-Peter Clausen

These two functions were added two years ago in commit 4805608 ("ASoC: dapm - Add methods to retrieve snd_card and soc_card from dapm context.") but have remained unused so far. Considering that the dapm context actually has a direct pointer to the card the functions also seem to be unnecessary. E.g. the expressions 'dapm_get_soc_card(dapm)' and 'dapm->card' yield the same result.

Applied, thanks.