[alsa-devel] [PATCH] 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.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de --- sound/soc/soc-dapm.c | 30 ------------------------------ 1 file changed, 30 deletions(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 346ac91..deb1b3d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -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;
On Tue, 2013-07-23 at 11:12 +0200, Lars-Peter Clausen wrote:
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.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de
Peter may have a user for these, but maybe not ?
Liam
On Tue, Jul 23, 2013 at 01:49:42PM +0100, Liam Girdwood wrote:
On Tue, 2013-07-23 at 11:12 +0200, Lars-Peter Clausen wrote:
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.
On 07/23/2013 07:36 PM, Mark Brown wrote:
On Tue, Jul 23, 2013 at 01:49:42PM +0100, Liam Girdwood wrote:
On Tue, 2013-07-23 at 11:12 +0200, Lars-Peter Clausen wrote:
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
On Tue, Jul 23, 2013 at 07:57:15PM +0200, Lars-Peter Clausen wrote:
On 07/23/2013 07:36 PM, Mark Brown wrote:
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.
On 07/23/2013 09:32 PM, Mark Brown wrote:
On Tue, Jul 23, 2013 at 07:57:15PM +0200, Lars-Peter Clausen wrote:
On 07/23/2013 07:36 PM, Mark Brown wrote:
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.
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
On Tue, Jul 23, 2013 at 09:47:58PM +0200, Lars-Peter Clausen wrote:
On 07/23/2013 09:32 PM, Mark Brown wrote:
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.
On 07/23/2013 02:49 PM, Liam Girdwood wrote:
On Tue, 2013-07-23 at 11:12 +0200, Lars-Peter Clausen wrote:
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.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de
Peter may have a user for these, but maybe not ?
No, I do not use these.
On Tue, Jul 23, 2013 at 11:12:25AM +0200, Lars-Peter Clausen wrote:
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.
participants (4)
-
Lars-Peter Clausen
-
Liam Girdwood
-
Mark Brown
-
Peter Ujfalusi