Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: soc-core: accept zero format at snd_soc_runtime_set_dai_fmt()

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>

authored by

Kuninori Morimoto and committed by
Mark Brown
7db07e37 41b1774f

+6 -8
-3
sound/soc/meson/meson-codec-glue.c
··· 113 113 /* Replace link params with the input params */ 114 114 rtd->dai_link->params = &in_data->params; 115 115 116 - if (!in_data->fmt) 117 - return 0; 118 - 119 116 return snd_soc_runtime_set_dai_fmt(rtd, in_data->fmt); 120 117 } 121 118 EXPORT_SYMBOL_GPL(meson_codec_glue_output_startup);
+6 -5
sound/soc/soc-core.c
··· 1218 1218 unsigned int i; 1219 1219 int ret; 1220 1220 1221 + if (!dai_fmt) 1222 + return 0; 1223 + 1221 1224 for_each_rtd_codec_dais(rtd, i, codec_dai) { 1222 1225 ret = snd_soc_dai_set_fmt(codec_dai, dai_fmt); 1223 1226 if (ret != 0 && ret != -ENOTSUPP) ··· 1264 1261 return ret; 1265 1262 1266 1263 snd_soc_runtime_get_dai_fmt(rtd); 1267 - if (dai_link->dai_fmt) { 1268 - ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); 1269 - if (ret) 1270 - return ret; 1271 - } 1264 + ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); 1265 + if (ret) 1266 + return ret; 1272 1267 1273 1268 /* add DPCM sysfs entries */ 1274 1269 soc_dpcm_debugfs_add(rtd);