es1968: fix sleep-while-holding-lock bug
authorArjan van de Ven <arjan@linux.intel.com>
Wed, 9 Apr 2008 00:41:55 +0000 (17:41 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 9 Apr 2008 01:25:53 +0000 (18:25 -0700)
commit4b47c971dc947cadecc20dc7681037e96ece520e
tree14afde1ea46a6b573ad1602e2ae440cb3f09ff1e
parent41e3355de052693c7a0cad74b845148d262edadf
es1968: fix sleep-while-holding-lock bug

snd_es1968_ac97_read() calls snd_es1968_ac97_wait() first outside a locked
area, and later, while holding a lock.

snd_es1968_ac97_wait() has a polling loop with a cond_resched() inside it..
which sleeps, so the second call is invalid.

This patch adds a version of the wait function that just pure polls.  While
this is not very elegant in principle, it's very likely the easiest thing to
do here, we already checked if the chip was ready (while yielding) just
before, so it is very unlikely to take a long time here.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
sound/pci/es1968.c