ASoC: Remove card field from snd_soc_dai struct
PATCH 1/2 ASoC: Remove card field from snd_soc_dai struct
The card field of the snd_soc_dai field is very rarely used. We can use dai->component->card instead and remove the card field from the snd_soc_dai struct.
--- include/sound/soc-dai.h | 2 -- sound/soc/soc-core.c | 7 +------ sound/soc/soc-dapm.c | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-)
include/sound/soc-dai.h +0 -2
@@ -275,8 +275,6 @@ struct snd_soc_dai {unsigned int tx_mask;unsigned int rx_mask; -struct snd_soc_card *card; -struct list_head list; };
sound/soc/soc-core.c +1 -6
@@ -1315,11 +1315,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)dev_dbg (card->dev,"ASoC: probe %s dai link %d late %d\n" , card->name, num, order); -/* config components */ - cpu_dai->card = card; -for (i =0 ; i < rtd->num_codecs; i++) - rtd->codec_dais[i]->card = card; -/* set default power off timeout */ rtd->pmdown_time = pmdown_time;
@@ -2314,7 +2309,7 @@ EXPORT_SYMBOL_GPL(snd_soc_add_card_controls);int snd_soc_add_dai_controls (struct snd_soc_dai *dai,const struct snd_kcontrol_new *controls,int num_controls) { -struct snd_card *card = dai->card->snd_card; +struct snd_card *card = dai->component->card->snd_card;return snd_soc_add_controls (card, dai->dev, controls, num_controls,NULL , dai);
sound/soc/soc-dapm.c +1 -1
@@ -1043,7 +1043,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,int snd_soc_dapm_dai_get_connected_widgets (struct snd_soc_dai *dai,int stream,struct snd_soc_dapm_widget_list **list) { -struct snd_soc_card *card = dai->card; +struct snd_soc_card *card = dai->component->card;struct snd_soc_dapm_widget *w;int paths;
Signature · 1 line
1.8.0
PATCH 2/2 ASoC: Consolidate CPU and CODEC DAI probe
CPU and CODEC DAI probe are performed in exactly the same way. Which means we can reuse the snd_soc_codec_dai_probe() for probing CPU DAIs as well.
While we are at it also drop the unused card parameter form the function.
--- sound/soc/soc-core.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-)
sound/soc/soc-core.c +12 -26
@@ -1241,25 +1241,22 @@ static int soc_probe_link_components(struct snd_soc_card *card, int num,return 0 ; } -static int soc_probe_codec_dai (struct snd_soc_card *card, -struct snd_soc_dai *codec_dai, -int order) +static int soc_probe_dai (struct snd_soc_dai *dai,int order) {int ret; -if (!codec_dai->probed && codec_dai->driver->probe_order == order) { -if (codec_dai->driver->probe) { - ret = codec_dai->driver->probe (codec_dai); +if (!dai->probed && dai->driver->probe_order == order) { +if (dai->driver->probe) { + ret = dai->driver->probe (dai);if (ret <0 ) { -dev_err (codec_dai->dev, -"ASoC: failed to probe CODEC DAI %s: %d\n" , - codec_dai->name, ret); +dev_err (dai->dev, +"ASoC: failed to probe DAI %s: %d\n" , + dai->name, ret);return ret; } } -/* mark codec_dai as probed and add to card dai list */ - codec_dai->probed =1 ; + dai->probed =1 ; }return 0 ;
@@ -1318,24 +1315,13 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)/* set default power off timeout */ rtd->pmdown_time = pmdown_time; -/* probe the cpu_dai */ -if (!cpu_dai->probed && - cpu_dai->driver->probe_order == order) { -if (cpu_dai->driver->probe) { - ret = cpu_dai->driver->probe (cpu_dai); -if (ret <0 ) { -dev_err (cpu_dai->dev, -"ASoC: failed to probe CPU DAI %s: %d\n" , - cpu_dai->name, ret); -return ret; - } - } - cpu_dai->probed =1 ; - } + ret =soc_probe_dai (cpu_dai, order); +if (ret) +return ret;/* probe the CODEC DAI */ for (i =0 ; i < rtd->num_codecs; i++) { - ret =soc_probe_codec_dai (card, rtd->codec_dais[i], order); + ret =soc_probe_dai (rtd->codec_dais[i], order);if (ret)return ret; }
Signature · 1 line
1.8.0
Re: [PATCH 2/2] ASoC: Consolidate CPU and CODEC DAI probe
Quoted 2 lines · Lars-Peter Clausen
CPU and CODEC DAI probe are performed in exactly the same way. Which means we can reuse the
snd_soc_codec_dai_probe()for probing CPU DAIs as well.
Applied, thanks.
Quoted 3 lines · Lars-Peter Clausen
The card field of the
snd_soc_daifield is very rarely used. We can usedai->component->cardinstead and remove the card field from thesnd_soc_daistruct.
Applied, thanks.