Skip to content

Commit

Permalink
ASoC: soc-core: accept zero format at snd_soc_runtime_set_dai_fmt()
Browse files Browse the repository at this point in the history
Do nothing if format was zero at snd_soc_runtime_set_dai_fmt().
soc-core.c can be more simple code by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ee8jt7d3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed Oct 18, 2021
1 parent 41b1774 commit 7db07e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 0 additions & 3 deletions sound/soc/meson/meson-codec-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ int meson_codec_glue_output_startup(struct snd_pcm_substream *substream,
/* Replace link params with the input params */
rtd->dai_link->params = &in_data->params;

if (!in_data->fmt)
return 0;

return snd_soc_runtime_set_dai_fmt(rtd, in_data->fmt);
}
EXPORT_SYMBOL_GPL(meson_codec_glue_output_startup);
Expand Down
11 changes: 6 additions & 5 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,9 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
unsigned int i;
int ret;

if (!dai_fmt)
return 0;

for_each_rtd_codec_dais(rtd, i, codec_dai) {
ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt);
if (ret != 0 && ret != -ENOTSUPP)
Expand Down Expand Up @@ -1261,11 +1264,9 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
return ret;

snd_soc_runtime_get_dai_fmt(rtd);
if (dai_link->dai_fmt) {
ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
if (ret)
return ret;
}
ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
if (ret)
return ret;

/* add DPCM sysfs entries */
soc_dpcm_debugfs_add(rtd);
Expand Down

0 comments on commit 7db07e3

Please sign in to comment.