All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Eliot Blennerhassett <bigblen@icqmail.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: snd_card_dummy_pcm_timer_function
Date: Mon, 19 May 2003 11:53:25 +0200	[thread overview]
Message-ID: <s5h1xyvdzze.wl@alsa2.suse.de> (raw)
In-Reply-To: <20030518180536.14882.h003.c012.wm@mail.icqmail.com.criticalpath.net>

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

      reply	other threads:[~2003-05-19  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-19  1:05 snd_card_dummy_pcm_timer_function Eliot Blennerhassett
2003-05-19  9:53 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h1xyvdzze.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=bigblen@icqmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.