Re: [BUG 2.6.0-test9] sleep from invalid function (ALSA related?)

Takashi Iwai
2003-11-14T11:16:41Z

[-- Attachment #1: Type: text/plain, Size: 435 bytes --]

At Thu, 13 Nov 2003 12:33:16 +0100,
Erik Mouw wrote:
>
> Hi,
>
> I compiled 2.6.0-test9 on my desktop last night. Not too many problems
> so far, but this debug trace caught my attention:
(snip)
> It looks ALSA related to me, the soundcard I use is a Midiman
> Audiophile 2496, which uses the ice1712 driver.

the attached patch should fix.
please give a try.

--
Takashi Iwai <tiwai@suse.de> ALSA Developer - www.alsa-project.org

[-- Attachment #2: i2c-lock-fix.dif --]
[-- Type: application/octet-stream, Size: 1431 bytes --]

diff -ru linux/include/sound linux/include/sound
--- linux/include/sound/i2c.h 23 Apr 2002 13:20:58 -0000 1.3
+++ linux/include/sound/i2c.h 13 Nov 2003 11:18:12 -0000 1.4
@@ -58,7 +58,7 @@
snd_card_t *card; /* card which I2C belongs to */
char name[32]; /* some useful label */

- spinlock_t lock;
+ struct semaphore lock_mutex;

snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */
struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
@@ -84,15 +84,15 @@

static inline void snd_i2c_lock(snd_i2c_bus_t *bus) {
if (bus->master)
- spin_lock(&bus->master->lock);
+ down(&bus->master->lock_mutex);
else
- spin_lock(&bus->lock);
+ down(&bus->lock_mutex);
}
static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) {
if (bus->master)
- spin_unlock(&bus->master->lock);
+ up(&bus->master->lock_mutex);
else
- spin_unlock(&bus->lock);
+ up(&bus->lock_mutex);
}

int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count);
diff -ru linux/sound linux/sound
--- linux/sound/i2c/i2c.c 2 Jun 2003 10:04:44 -0000 1.7
+++ linux/sound/i2c/i2c.c 13 Nov 2003 11:18:25 -0000 1.8
@@ -84,7 +84,7 @@
bus = (snd_i2c_bus_t *)snd_magic_kcalloc(snd_i2c_bus_t, 0, GFP_KERNEL);
if (bus == NULL)
return -ENOMEM;
- spin_lock_init(&bus->lock);
+ init_MUTEX(&bus->lock_mutex);
INIT_LIST_HEAD(&bus->devices);
INIT_LIST_HEAD(&bus->buses);
bus->card = card;