From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: snd_card_dummy_pcm_timer_function Date: Mon, 19 May 2003 11:53:25 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <20030518180536.14882.h003.c012.wm@mail.icqmail.com.criticalpath.net> Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20030518180536.14882.h003.c012.wm@mail.icqmail.com.criticalpath.net> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Eliot Blennerhassett Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Sun, 18 May 2003 18:05:36 -0700 (PDT), Eliot Blennerhassett wrote: > > static void snd_card_dummy_pcm_timer_function(unsigned long data) > { > ... > spin_lock_irq(&dpcm->lock); > ... > while (dpcm->pcm_irq_pos >= dpcm->pcm_count) { > dpcm->pcm_irq_pos -= dpcm->pcm_count; > snd_pcm_period_elapsed(dpcm->substream); > } > spin_unlock_irq(&dpcm->lock); > } > > Should the while loop be replaced by this, because > * Even if more than one periods have elapsed since the last call, you > * have to call this (snd_pcm_period_elapsed) only once. yes :) should be fixed. > > > if (dpcm->pcm_irq_pos >= dpcm->pcm_count) { > dpcm->pcm_irq_pos %= dpcm->pcm_count; > ?? spin_unlock_irq() > snd_pcm_period_elapsed(dpcm->substream); > ?? spin_lock_irq() > } spin_unlock/lock are not needed because other callbacks don't issue this spinlock. thus no dead lock would occur. Takashi ------------------------------------------------------- This SF.net email is sponsored by: If flattening out C++ or Java code to make your application fit in a relational database is painful, don't do it! Check out ObjectStore. Now part of Progress Software. http://www.objectstore.net/sourceforge