Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 9 Oct 2001 15:27:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 9 Oct 2001 15:27:45 -0400 Received: from nsd.mandrakesoft.com ([216.71.84.35]:49172 "EHLO mandrakesoft.mandrakesoft.com") by vger.kernel.org with ESMTP id ; Tue, 9 Oct 2001 15:27:31 -0400 Date: Tue, 9 Oct 2001 14:27:46 -0500 (CDT) From: Jeff Garzik To: Rui Sousa cc: Linus Torvalds , Alan Cox , linux-kernel@vger.kernel.org, emu10k1-devel@opensource.creative.com Subject: Re: [Emu10k1-devel] Re: Emu10k1 driver update In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Oct 2001, Rui Sousa wrote: > On Tue, 9 Oct 2001, Jeff Garzik wrote: > From what I see doing locking with a spinlock is quite tricky. > > codec->read_mixer = ac97_read_mixer; //can be called holding spinlock > codec->write_mixer = ac97_write_mixer; //can be called holding spinlock > codec->recmask_io = ac97_recmask_io; > codec->mixer_ioctl = ac97_mixer_ioctl; //in general can't be called > holding spinlock > > and ac97_mixer_ioctl() itself calls ac97_read/write_mixer(). > > A semaphore on the mixer device open function would do just fine If I > didn't had an interrupt handler also touching the ac97_codec... Yep, that's how the via audio problem was solved, with a mixer semaphore. Having your interrupt handler touch ac97_codec definitely complicates things beyond that simple solution, though. If your only concern is the intr handler you could create a dont-touch-ac97-in-intr flag, and set that flag (only) via spin_lock_irq. Then you don't have to stay inside a spinlock the entire time. Jeff - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/