From d6e4218e28b75c4701a8c8d12e989de1dc97c182 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 30 Mar 2008 19:53:23 +0300 Subject: sound/oss/ac97_codec.c: restore MODULE_LICENSE I accidentally removed the module license from sound/oss/ac97_codec.c in commit 83bad1d764b836a482b88e0a1f44d7a5c3e1fee0 ("scheduled OSS driver removal") Spotted by Roland . Signed-off-by: Adrian Bunk Signed-off-by: Linus Torvalds --- sound/oss/ac97_codec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c index 87a67268076..b63839e8f9b 100644 --- a/sound/oss/ac97_codec.c +++ b/sound/oss/ac97_codec.c @@ -1202,3 +1202,5 @@ static int pt101_init(struct ac97_codec * codec) EXPORT_SYMBOL(ac97_probe_codec); +MODULE_LICENSE("GPL"); + -- cgit v1.2.3 From 4b47c971dc947cadecc20dc7681037e96ece520e Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Tue, 8 Apr 2008 17:41:55 -0700 Subject: 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 Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/pci/es1968.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 25ccfce4575..7d911a18c08 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -617,6 +617,18 @@ static int snd_es1968_ac97_wait(struct es1968 *chip) return 1; /* timeout */ } +static int snd_es1968_ac97_wait_poll(struct es1968 *chip) +{ + int timeout = 100000; + + while (timeout-- > 0) { + if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1)) + return 0; + } + snd_printd("es1968: ac97 timeout\n"); + return 1; /* timeout */ +} + static void snd_es1968_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) { struct es1968 *chip = ac97->private_data; @@ -645,7 +657,7 @@ static unsigned short snd_es1968_ac97_read(struct snd_ac97 *ac97, unsigned short outb(reg | 0x80, chip->io_port + ESM_AC97_INDEX); /*msleep(1);*/ - if (! snd_es1968_ac97_wait(chip)) { + if (!snd_es1968_ac97_wait_poll(chip)) { data = inw(chip->io_port + ESM_AC97_DATA); /*msleep(1);*/ } -- cgit v1.2.3