All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_card_dummy_pcm_timer_function
@ 2003-05-19  1:05 Eliot Blennerhassett
  2003-05-19  9:53 ` snd_card_dummy_pcm_timer_function Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Eliot Blennerhassett @ 2003-05-19  1:05 UTC (permalink / raw)
  To: alsa-devel

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.


	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()
	}

Eliot Blennerhassett
AudioScience Inc.
--
Junk footer beyond this point. Read at your own risk.


-------------------------------------------------------------
Sign up for ICQmail at http://www.icq.com/icqmail/signup.html


-------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: snd_card_dummy_pcm_timer_function
  2003-05-19  1:05 snd_card_dummy_pcm_timer_function Eliot Blennerhassett
@ 2003-05-19  9:53 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2003-05-19  9:53 UTC (permalink / raw)
  To: Eliot Blennerhassett; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-19  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-19  1:05 snd_card_dummy_pcm_timer_function Eliot Blennerhassett
2003-05-19  9:53 ` snd_card_dummy_pcm_timer_function Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.