Skip to contentSkip to conversation

ASoC : fsl_ssi : Correct the condition to check AC97 mode

PATCH In review Harisangam, Sharvari (S.) 5 participants 7 messages Dec 28, 2016 – Jan 4, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC : fsl_ssi : Correct the condition to check AC97 mode

Corrected the condition to check if ssi is configured for AC97 mode. Other modes like dsp_a also satisfy the ANDing condition.

---
 sound/soc/fsl/fsl_ssi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_ssi.c +3 -2
index ca6f6b1..4fbb7a2 100644
@@ -317,7 +317,8 @@ MODULE_DEVICE_TABLE(of, fsl_ssi_ids);
 
 static bool fsl_ssi_is_ac97(struct fsl_ssi_private *ssi_private)
 {
-	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97);
+	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
+		SND_SOC_DAIFMT_AC97;
 }
 
 static bool fsl_ssi_is_i2s_master(struct fsl_ssi_private *ssi_private)
@@ -1016,7 +1017,7 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
 				CCSR_SSI_SCR_TCH_EN);
 	}
 
-	if (fmt & SND_SOC_DAIFMT_AC97)
+	if ((fmt & SND_SOC_DAIFMT_AC97) == SND_SOC_DAIFMT_AC97)
 		fsl_ssi_setup_ac97(ssi_private);
 
 	return 0;
Signature · 1 line
2.7.4
#1 lore raw

sound/soc/fsl/fsl_ssi.c MODULE_DEVICE_TABLE(of, fsl_ssi_ids); · line 321

Quoted 2 lines · Sharvari (S.)
sound/soc/fsl/fsl_ssi.c +2 -0
+	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
+		SND_SOC_DAIFMT_AC97;

This is never true.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#2 lore raw
Quoted 3 lines · Andreas Schwab
Quoted 2 lines

sound/soc/fsl/fsl_ssi.c MODULE_DEVICE_TABLE(of, fsl_ssi_ids); · line 321

Quoted 2 lines
sound/soc/fsl/fsl_ssi.c +2 -0
+	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
+		SND_SOC_DAIFMT_AC97;

This is never true.

I think the right parenthesis should be at the end of the expression.

#3 lore raw
In reply to Andreas Schwab
Quoted 13 lines · Andreas Schwab

sound/soc/fsl/fsl_ssi.c MODULE_DEVICE_TABLE(of, fsl_ssi_ids); · line 321

Quoted 2 lines · Sharvari (S.)
sound/soc/fsl/fsl_ssi.c +2 -0
+	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
+		SND_SOC_DAIFMT_AC97;

This is never true.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Ok. I missed the braces there. I will modify and resubmit the patch

-Thanks
Sharvari

A message that is not in the archive (sent off-list or not yet received): 9ebb798c-6040-9262-9625-ddcebd05a188__32955.7460187518$1482940206$gmane$org@tabi.org

#5 lore raw
Quoted 6 lines · Timur Tabi
Quoted 3 lines · Andreas Schwab
Quoted 2 lines

sound/soc/fsl/fsl_ssi.c MODULE_DEVICE_TABLE(of, fsl_ssi_ids); · line 321

Quoted 2 lines
sound/soc/fsl/fsl_ssi.c +2 -0
+	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
+		SND_SOC_DAIFMT_AC97;

This is never true.

I think the right parenthesis should be at the end of the expression.

That would still test the wrong bitfield.

And all that is obsolete anyway since commit 5b64c173cd (of Sep 2015).

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#7 lore raw
In reply to Harisangam, Sharvari (S.)

From: Harisangam, Sharvari (S.)

Quoted 3 lines

Sent: 28 December 2016 11:07
Corrected the condition to check if ssi is configured for AC97 mode. Other modes like dsp_a also satisfy the ANDing condition.

Under the assumption that the constants have 1 bit set nothing is wrong.

David

...

Quoted 1 line
sound/soc/fsl/fsl_ssi.c +0 -1
-	return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97);

...

Quoted 1 line
sound/soc/fsl/fsl_ssi.c +0 -1
-	if (fmt & SND_SOC_DAIFMT_AC97)

...