diff options
author | Dan Carpenter <error27@gmail.com> | 2010-04-28 04:29:14 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-05-05 03:57:08 -0400 |
commit | bfe70783ca8e61f1fc3588cd59c4f1b755e9d3cf (patch) | |
tree | 45818522458f570d98f90abcbc9cc685a206b48f /sound | |
parent | 867f1845c53f52e6b9822bea387c7b16740ba2f8 (diff) |
ALSA: take tu->qlock with irqs disabled
We should disable irqs when we take the tu->qlock because it is used in
the irq handler. The only place that doesn't is
snd_timer_user_ccallback(). Most of the time snd_timer_user_ccallback()
is called with interrupts disabled but the the first ti->ccallback()
call in snd_timer_notify1() has interrupts enabled.
This was caught by lockdep which generates the following message:
> =================================
> [ INFO: inconsistent lock state ]
> 2.6.34-rc5 #5
> ---------------------------------
> inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
> dolphin/4003 [HC1[1]:SC0[0]:HE0:SE1] takes:
> (&(&tu->qlock)->rlock){?.+...}, at: [<f84ec472>] snd_timer_user_tinterrupt+0x28/0x132 [snd_timer]
> {HARDIRQ-ON-W} state was registered at:
> [<c1048de9>] __lock_acquire+0x654/0x1482
> [<c1049c73>] lock_acquire+0x5c/0x73
> [<c125ac3e>] _raw_spin_lock+0x25/0x34
> [<f84ec370>] snd_timer_user_ccallback+0x55/0x95 [snd_timer]
> [<f84ecc4b>] snd_timer_notify1+0x53/0xca [snd_timer]
Reported-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/timer.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index 73943651cae..5040c7b862f 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -1160,6 +1160,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, | |||
1160 | { | 1160 | { |
1161 | struct snd_timer_user *tu = timeri->callback_data; | 1161 | struct snd_timer_user *tu = timeri->callback_data; |
1162 | struct snd_timer_tread r1; | 1162 | struct snd_timer_tread r1; |
1163 | unsigned long flags; | ||
1163 | 1164 | ||
1164 | if (event >= SNDRV_TIMER_EVENT_START && | 1165 | if (event >= SNDRV_TIMER_EVENT_START && |
1165 | event <= SNDRV_TIMER_EVENT_PAUSE) | 1166 | event <= SNDRV_TIMER_EVENT_PAUSE) |
@@ -1169,9 +1170,9 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, | |||
1169 | r1.event = event; | 1170 | r1.event = event; |
1170 | r1.tstamp = *tstamp; | 1171 | r1.tstamp = *tstamp; |
1171 | r1.val = resolution; | 1172 | r1.val = resolution; |
1172 | spin_lock(&tu->qlock); | 1173 | spin_lock_irqsave(&tu->qlock, flags); |
1173 | snd_timer_user_append_to_tqueue(tu, &r1); | 1174 | snd_timer_user_append_to_tqueue(tu, &r1); |
1174 | spin_unlock(&tu->qlock); | 1175 | spin_unlock_irqrestore(&tu->qlock, flags); |
1175 | kill_fasync(&tu->fasync, SIGIO, POLL_IN); | 1176 | kill_fasync(&tu->fasync, SIGIO, POLL_IN); |
1176 | wake_up(&tu->qchange_sleep); | 1177 | wake_up(&tu->qchange_sleep); |
1177 | } | 1178 | } |