Subject: [PATCH] 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.

Signed-off-by: Sharvari Harisangam <[email protected]>
---
sound/soc/fsl/fsl_ssi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index ca6f6b1..4fbb7a2 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -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;
--
2.7.4


2016-12-28 14:51:39

by Andreas Schwab

[permalink] [raw]
Subject: Re: [PATCH] ASoC : fsl_ssi : Correct the condition to check AC97 mode

On Dez 28 2016, "Harisangam, Sharvari (S.)" <[email protected]> wrote:

> + return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
> + SND_SOC_DAIFMT_AC97;

This is never true.

Andreas.

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

2016-12-28 15:55:36

by Timur Tabi

[permalink] [raw]
Subject: Re: [PATCH] ASoC : fsl_ssi : Correct the condition to check AC97 mode

Andreas Schwab wrote:
>> > + 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.

2016-12-28 17:54:02

by Fabio Estevam

[permalink] [raw]
Subject: Re: [alsa-devel] [PATCH] ASoC : fsl_ssi : Correct the condition to check AC97 mode

On Wed, Dec 28, 2016 at 9:06 AM, Harisangam, Sharvari (S.)
<[email protected]> wrote:
> Corrected the condition to check if ssi is configured for AC97
> mode. Other modes like dsp_a also satisfy the ANDing condition.
>
> Signed-off-by: Sharvari Harisangam <[email protected]>

This has been fixed in 4.3 kernel by commit:

5b64c173cdea211 ("ASoC: fsl_ssi: Fix checking of dai format for AC97 mode")

Subject: Re: [PATCH] ASoC : fsl_ssi : Correct the condition to check AC97 mode

On Wed, Dec 28, 2016 at 03:50:57PM +0100, Andreas Schwab wrote:
> On Dez 28 2016, "Harisangam, Sharvari (S.)" <[email protected]> wrote:
>
> > + return !!(ssi_private->dai_fmt & SND_SOC_DAIFMT_AC97) ==
> > + SND_SOC_DAIFMT_AC97;
>
> This is never true.
>
> Andreas.
>
> --
> 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