diff options
| author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2025-12-16 09:24:32 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-12-17 15:04:39 +0300 |
| commit | f764645cb85a8b8f58067289cdfed28f6c1cdf49 (patch) | |
| tree | 77f89ccbf566fff81b549b4dcf395635fb80ccf6 | |
| parent | 3e43a8c033c3187e0f441ed5570a0fb5dcc9dafb (diff) | |
| download | linux-f764645cb85a8b8f58067289cdfed28f6c1cdf49.tar.xz | |
ASoC: codecs: tas2780: tidyup format check in tas2780_set_fmt()
Current code is using messy code to check format. Let's cleanup
it by using switch().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87h5trrljz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/codecs/tas2780.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sound/soc/codecs/tas2780.c b/sound/soc/codecs/tas2780.c index a1963415c931..cf3f6abd7e7b 100644 --- a/sound/soc/codecs/tas2780.c +++ b/sound/soc/codecs/tas2780.c @@ -319,25 +319,22 @@ static int tas2780_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) goto err; } - if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S) - || ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) - == SND_SOC_DAIFMT_DSP_A)){ + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: + case SND_SOC_DAIFMT_DSP_A: iface = TAS2780_TDM_CFG2_SCFG_I2S; tdm_rx_start_slot = 1; - } else { - if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) - == SND_SOC_DAIFMT_DSP_B) - || ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) - == SND_SOC_DAIFMT_LEFT_J)) { - iface = TAS2780_TDM_CFG2_SCFG_LEFT_J; - tdm_rx_start_slot = 0; - } else { - dev_err(tas2780->dev, - "%s:DAI Format is not found, fmt=0x%x\n", - __func__, fmt); - ret = -EINVAL; - goto err; - } + break; + case SND_SOC_DAIFMT_LEFT_J: + case SND_SOC_DAIFMT_DSP_B: + iface = TAS2780_TDM_CFG2_SCFG_LEFT_J; + tdm_rx_start_slot = 0; + break; + default: + dev_err(tas2780->dev, + "%s:DAI Format is not found, fmt=0x%x\n", __func__, fmt); + ret = -EINVAL; + goto err; } ret = snd_soc_component_update_bits(component, TAS2780_TDM_CFG1, TAS2780_TDM_CFG1_MASK, |
