[alsa-devel] [PATCH] ASoC: topology: Modify clock gating parameter parsing to switch

Kirill Marinushkin k.marinushkin at gmail.com
Mon Apr 16 19:56:44 CEST 2018


This improves the coding style of this piece of code.

Signed-off-by: Kirill Marinushkin <k.marinushkin at gmail.com>
Cc: Mark Brown <broonie at kernel.org>
Cc: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
Cc: Jaroslav Kysela <perex at perex.cz>
Cc: Takashi Iwai <tiwai at suse.de>
Cc: Pan Xiuli <xiuli.pan at linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood at linux.intel.com>
Cc: linux-kernel at vger.kernel.org
Cc: alsa-devel at alsa-project.org
---
 sound/soc/soc-topology.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 04f834e6a6b5..802bad7ddcb4 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1982,11 +1982,19 @@ static void set_link_hw_format(struct snd_soc_dai_link *link,
 		link->dai_fmt = hw_config->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
 
 		/* clock gating */
-		if (hw_config->clock_gated == SND_SOC_TPLG_DAI_CLK_GATE_GATED)
+		switch (hw_config->clock_gated) {
+		case SND_SOC_TPLG_DAI_CLK_GATE_GATED:
 			link->dai_fmt |= SND_SOC_DAIFMT_GATED;
-		else if (hw_config->clock_gated ==
-			 SND_SOC_TPLG_DAI_CLK_GATE_CONT)
+			break;
+
+		case SND_SOC_TPLG_DAI_CLK_GATE_CONT:
 			link->dai_fmt |= SND_SOC_DAIFMT_CONT;
+			break;
+
+		default:
+			/* ignore the value */
+			break;
+		}
 
 		/* clock signal polarity */
 		invert_bclk = hw_config->invert_bclk;
-- 
2.13.6



More information about the Alsa-devel mailing list