Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332186
b: refs/heads/master
c: d4f1e48
h: refs/heads/master
v: v3
  • Loading branch information
Omair Mohammed Abdullah authored and Takashi Iwai committed Oct 6, 2012
1 parent 971795e commit e9816f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d17344b3547669f5b6ee4fda993d03737a141bd6
refs/heads/master: d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d
6 changes: 6 additions & 0 deletions trunk/sound/drivers/aloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ struct loopback_pcm {
unsigned int last_drift;
unsigned long last_jiffies;
struct timer_list timer;
spinlock_t timer_lock;
};

static struct platform_device *devices[SNDRV_CARDS];
Expand Down Expand Up @@ -170,6 +171,7 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
unsigned long tick;
unsigned int rate_shift = get_rate_shift(dpcm);

spin_lock(&dpcm->timer_lock);
if (rate_shift != dpcm->pcm_rate_shift) {
dpcm->pcm_rate_shift = rate_shift;
dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size);
Expand All @@ -182,12 +184,15 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
dpcm->timer.expires = jiffies + tick;
add_timer(&dpcm->timer);
spin_unlock(&dpcm->timer_lock);
}

static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
{
spin_lock(&dpcm->timer_lock);
del_timer(&dpcm->timer);
dpcm->timer.expires = 0;
spin_unlock(&dpcm->timer_lock);
}

#define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
Expand Down Expand Up @@ -667,6 +672,7 @@ static int loopback_open(struct snd_pcm_substream *substream)
dpcm->substream = substream;
setup_timer(&dpcm->timer, loopback_timer_function,
(unsigned long)dpcm);
spin_lock_init(&dpcm->timer_lock);

cable = loopback->cables[substream->number][dev];
if (!cable) {
Expand Down

0 comments on commit e9816f1

Please sign in to comment.