Skip to contentSkip to conversation

ALSA/NUC900: Fix a while loop bug for nuc900 alsa driver

PATCH Liam Girdwood 1 participant 1 message Jun 1, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · Wan ZongShun

Dear all,

This patch is to fix a while loop bug for nuc900 alsa driver.

Which bug ? It's best to say the bug you are fixing when submitting a patch like this.

Thanks

Liam

Quoted 35 lines
---
 sound/soc/nuc900/nuc900-ac97.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
sound/soc/nuc900/nuc900-ac97.c +4 -6
index 5b864f9..db7fc13 100644
@@ -66,9 +66,8 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97,
 	udelay(100);
 
 	/* polling the AC_R_FINISH */
-	val = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON);
-	val &= AC_R_FINISH;
-	while (!val && timeout--)
+	while (!(AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_R_FINISH)
+								&& timeout--)
 		mdelay(1);
 
 	if (!timeout) {
@@ -121,9 +120,8 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned
 short reg,
 	udelay(100);
 
 	/* polling the AC_W_FINISH */
-	tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON);
-	tmp &= AC_W_FINISH;
-	while (tmp && timeout--)
+	while ((AUDIO_READ(nuc900_audio->mmio + ACTL_ACCON) & AC_W_FINISH)
+								&& timeout--)
 		mdelay(1);
 

if (!timeout)