From: Krzysztof Helt <krzysztof.h1@xxxxx> This patch removes open_mutex from the ad1848-lib as open and close operations are called only from pcm layer and mutexed there with pcm->open_mutex. Signed-off-by: Krzysztof Helt <krzysztof.h1@xxxxx> --- Another step into crusade against the ad1848-lib. Inspired by Trent's comments about missing locking I have checked and open and close operations are already mutexed in the pcm layer by similarly called pcm->open_mutex. The OSS pcm layer also uses the pcm->open_mutex. Is it right thing to do? (Takashi, Jaroslav)? Regards, Krzysztof diff -urp linux-ref/include/sound/ad1848.h linux-2.6.23/include/sound/ad1848.h --- linux-ref/include/sound/ad1848.h 2007-09-12 13:33:51.000000000 +0200 +++ linux-2.6.23/include/sound/ad1848.h 2007-09-19 17:54:30.000000000 +0200 @@ -154,7 +154,6 @@ struct snd_ad1848 { #endif spinlock_t reg_lock; - struct mutex open_mutex; }; /* exported functions */ diff -urp linux-ref/sound/isa/ad1848/ad1848_lib.c linux-2.6.23/sound/isa/ad1848/ad1848_lib.c --- linux-ref/sound/isa/ad1848/ad1848_lib.c 2007-09-12 13:33:51.000000000 +0200 +++ linux-2.6.23/sound/isa/ad1848/ad1848_lib.c 2007-09-19 17:59:38.000000000 +0200 @@ -391,11 +391,9 @@ static int snd_ad1848_open(struct snd_ad { unsigned long flags; - mutex_lock(&chip->open_mutex); - if (chip->mode & AD1848_MODE_OPEN) { - mutex_unlock(&chip->open_mutex); + if (chip->mode & AD1848_MODE_OPEN) return -EAGAIN; - } + snd_ad1848_mce_down(chip); #ifdef SNDRV_DEBUG_MCE @@ -436,7 +434,6 @@ static int snd_ad1848_open(struct snd_ad spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = mode; - mutex_unlock(&chip->open_mutex); return 0; } @@ -445,11 +442,8 @@ static void snd_ad1848_close(struct snd_ { unsigned long flags; - mutex_lock(&chip->open_mutex); - if (!chip->mode) { - mutex_unlock(&chip->open_mutex); + if (!chip->mode) return; - } /* disable IRQ */ spin_lock_irqsave(&chip->reg_lock, flags); outb(0, AD1848P(chip, STATUS)); /* clear IRQ */ @@ -475,7 +469,6 @@ static void snd_ad1848_close(struct snd_ spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = 0; - mutex_unlock(&chip->open_mutex); } /* @@ -893,7 +886,6 @@ int snd_ad1848_create(struct snd_card *c if (chip == NULL) return -ENOMEM; spin_lock_init(&chip->reg_lock); - mutex_init(&chip->open_mutex); chip->card = card; chip->port = port; chip->irq = -1; _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel