ASoC: Remove unused dapm_get_snd_card() and dapm_get_soc_card()
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
@@ -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
Quoted 8 lines · Lars-Peter Clausen
These two functions were added two years ago in commit 4805608 ("ASoC: dapm - Add methods to retrieve
snd_cardandsoc_cardfrom 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.Signed-off-by Lars-Peter Clausen <[email protected]>---
Peter may have a user for these, but maybe not ?
Liam
Mark Brown
maintainerQuoted 8 lines · Liam Girdwood
Quoted 4 lines · Lars-Peter Clausen
Add methods to retrieve
snd_cardandsoc_cardfrom 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.
Quoted 12 lines · Mark Brown
Quoted 8 lines · Liam Girdwood
Quoted 4 lines · Lars-Peter Clausen
Add methods to retrieve
snd_cardandsoc_cardfrom 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
Mark Brown
maintainerQuoted 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->cardinstead. It's much more simpler than this 'if (dapm->codec) returndapm->codec->card; else if (dapm->platform) returndapm->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.
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->cardinstead. It's much more simpler than this 'if (dapm->codec) returndapm->codec->card; else if (dapm->platform) returndapm->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->cardisn'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
Mark Brown
maintainerQuoted 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->cardisn'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.
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_cardandsoc_cardfrom 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.Signed-off-by Lars-Peter Clausen <[email protected]>---
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
Quoted 5 lines · Lars-Peter Clausen
These two functions were added two years ago in commit 4805608 ("ASoC: dapm - Add methods to retrieve
snd_cardandsoc_cardfrom 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.