ASoC: convert for_each_rtd_codec_dai() for missing part

commit 0b7990e389 ("ASoC: add for_each_rtd_codec_dai() macro")
added for_each_rtd_codec_dai(), but it didn't convert few loop
which is not using "rtd". This patch fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2018-09-18 01:28:04 +00:00 committed by Mark Brown
parent 3a6818c771
commit 7afecb3073
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -1301,6 +1301,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
struct snd_soc_dapm_widget *widget, int stream) struct snd_soc_dapm_widget *widget, int stream)
{ {
struct snd_soc_pcm_runtime *be; struct snd_soc_pcm_runtime *be;
struct snd_soc_dai *dai;
int i; int i;
dev_dbg(card->dev, "ASoC: find BE for widget %s\n", widget->name); dev_dbg(card->dev, "ASoC: find BE for widget %s\n", widget->name);
@ -1318,8 +1319,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
if (be->cpu_dai->playback_widget == widget) if (be->cpu_dai->playback_widget == widget)
return be; return be;
for (i = 0; i < be->num_codecs; i++) { for_each_rtd_codec_dai(be, i, dai) {
struct snd_soc_dai *dai = be->codec_dais[i];
if (dai->playback_widget == widget) if (dai->playback_widget == widget)
return be; return be;
} }
@ -1338,8 +1338,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
if (be->cpu_dai->capture_widget == widget) if (be->cpu_dai->capture_widget == widget)
return be; return be;
for (i = 0; i < be->num_codecs; i++) { for_each_rtd_codec_dai(be, i, dai) {
struct snd_soc_dai *dai = be->codec_dais[i];
if (dai->capture_widget == widget) if (dai->capture_widget == widget)
return be; return be;
} }
@ -1435,6 +1434,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
struct snd_soc_dpcm *dpcm; struct snd_soc_dpcm *dpcm;
struct snd_soc_dapm_widget_list *list = *list_; struct snd_soc_dapm_widget_list *list = *list_;
struct snd_soc_dapm_widget *widget; struct snd_soc_dapm_widget *widget;
struct snd_soc_dai *dai;
int prune = 0; int prune = 0;
/* Destroy any old FE <--> BE connections */ /* Destroy any old FE <--> BE connections */
@ -1449,8 +1449,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
continue; continue;
/* is there a valid CODEC DAI widget for this BE */ /* is there a valid CODEC DAI widget for this BE */
for (i = 0; i < dpcm->be->num_codecs; i++) { for_each_rtd_codec_dai(dpcm->be, i, dai) {
struct snd_soc_dai *dai = dpcm->be->codec_dais[i];
widget = dai_get_widget(dai, stream); widget = dai_get_widget(dai, stream);
/* prune the BE if it's no longer in our active list */ /* prune the BE if it's no longer in our active list */
@ -1685,6 +1684,7 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
{ {
struct snd_soc_pcm_runtime *fe = substream->private_data; struct snd_soc_pcm_runtime *fe = substream->private_data;
struct snd_soc_dpcm *dpcm; struct snd_soc_dpcm *dpcm;
struct snd_soc_dai *dai;
int stream = substream->stream; int stream = substream->stream;
if (!fe->dai_link->dpcm_merged_format) if (!fe->dai_link->dpcm_merged_format)
@ -1701,16 +1701,15 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
struct snd_soc_pcm_stream *codec_stream; struct snd_soc_pcm_stream *codec_stream;
int i; int i;
for (i = 0; i < be->num_codecs; i++) { for_each_rtd_codec_dai(be, i, dai) {
/* /*
* Skip CODECs which don't support the current stream * Skip CODECs which don't support the current stream
* type. See soc_pcm_init_runtime_hw() for more details * type. See soc_pcm_init_runtime_hw() for more details
*/ */
if (!snd_soc_dai_stream_valid(be->codec_dais[i], if (!snd_soc_dai_stream_valid(dai, stream))
stream))
continue; continue;
codec_dai_drv = be->codec_dais[i]->driver; codec_dai_drv = dai->driver;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) if (stream == SNDRV_PCM_STREAM_PLAYBACK)
codec_stream = &codec_dai_drv->playback; codec_stream = &codec_dai_drv->playback;
else else
@ -1795,6 +1794,7 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
struct snd_soc_dai_driver *codec_dai_drv; struct snd_soc_dai_driver *codec_dai_drv;
struct snd_soc_pcm_stream *codec_stream; struct snd_soc_pcm_stream *codec_stream;
struct snd_soc_pcm_stream *cpu_stream; struct snd_soc_pcm_stream *cpu_stream;
struct snd_soc_dai *dai;
int i; int i;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) if (stream == SNDRV_PCM_STREAM_PLAYBACK)
@ -1806,16 +1806,15 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
*rate_max = min_not_zero(*rate_max, cpu_stream->rate_max); *rate_max = min_not_zero(*rate_max, cpu_stream->rate_max);
*rates = snd_pcm_rate_mask_intersect(*rates, cpu_stream->rates); *rates = snd_pcm_rate_mask_intersect(*rates, cpu_stream->rates);
for (i = 0; i < be->num_codecs; i++) { for_each_rtd_codec_dai(be, i, dai) {
/* /*
* Skip CODECs which don't support the current stream * Skip CODECs which don't support the current stream
* type. See soc_pcm_init_runtime_hw() for more details * type. See soc_pcm_init_runtime_hw() for more details
*/ */
if (!snd_soc_dai_stream_valid(be->codec_dais[i], if (!snd_soc_dai_stream_valid(dai, stream))
stream))
continue; continue;
codec_dai_drv = be->codec_dais[i]->driver; codec_dai_drv = dai->driver;
if (stream == SNDRV_PCM_STREAM_PLAYBACK) if (stream == SNDRV_PCM_STREAM_PLAYBACK)
codec_stream = &codec_dai_drv->playback; codec_stream = &codec_dai_drv->playback;
else else
@ -2784,6 +2783,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
struct snd_soc_dpcm *dpcm; struct snd_soc_dpcm *dpcm;
struct list_head *clients = struct list_head *clients =
&fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients; &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients;
struct snd_soc_dai *dai;
list_for_each_entry(dpcm, clients, list_be) { list_for_each_entry(dpcm, clients, list_be) {
@ -2793,8 +2793,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
if (be->dai_link->ignore_suspend) if (be->dai_link->ignore_suspend)
continue; continue;
for (i = 0; i < be->num_codecs; i++) { for_each_rtd_codec_dai(be, i, dai) {
struct snd_soc_dai *dai = be->codec_dais[i];
struct snd_soc_dai_driver *drv = dai->driver; struct snd_soc_dai_driver *drv = dai->driver;
dev_dbg(be->dev, "ASoC: BE digital mute %s\n", dev_dbg(be->dev, "ASoC: BE digital mute %s\n",