diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-03-18 07:39:08 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-03-18 07:39:08 +0100 |
commit | d351cf4603edb2a5bfa9a48d06c425511c63f2a3 (patch) | |
tree | b03ea3cfd3ca3974237563cf87328386c3d49ff1 /sound/drivers | |
parent | 433e8327caf9f7c0432b2f2f6684a5b79cfe18e9 (diff) | |
parent | 4a122c10fbfe9020df469f0f669da129c5757671 (diff) |
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/drivers')
-rw-r--r-- | sound/drivers/aloop.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 12b44b0b677..a0da7755fce 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -482,8 +482,9 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) cable->streams[SNDRV_PCM_STREAM_CAPTURE]; unsigned long delta_play = 0, delta_capt = 0; unsigned int running; + unsigned long flags; - spin_lock(&cable->lock); + spin_lock_irqsave(&cable->lock, flags); running = cable->running ^ cable->pause; if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) { delta_play = jiffies - dpcm_play->last_jiffies; @@ -495,10 +496,8 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) dpcm_capt->last_jiffies += delta_capt; } - if (delta_play == 0 && delta_capt == 0) { - spin_unlock(&cable->lock); - return running; - } + if (delta_play == 0 && delta_capt == 0) + goto unlock; if (delta_play > delta_capt) { loopback_bytepos_update(dpcm_play, delta_play - delta_capt, @@ -510,14 +509,14 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable) delta_capt = delta_play; } - if (delta_play == 0 && delta_capt == 0) { - spin_unlock(&cable->lock); - return running; - } + if (delta_play == 0 && delta_capt == 0) + goto unlock; + /* note delta_capt == delta_play at this moment */ loopback_bytepos_update(dpcm_capt, delta_capt, BYTEPOS_UPDATE_COPY); loopback_bytepos_update(dpcm_play, delta_play, BYTEPOS_UPDATE_POSONLY); - spin_unlock(&cable->lock); + unlock: + spin_unlock_irqrestore(&cable->lock, flags); return running; } |