diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2006-10-27 14:15:35 +0200 |
---|---|---|
committer | Chris Wright <chrisw@sous-sol.org> | 2006-11-03 17:33:48 -0800 |
commit | c8ec7067774748f29dae43682df884d329a7cb9e (patch) | |
tree | 1813b177bc6357167173bd0a30ae23746e30dbe0 | |
parent | f3873b8c111b5042869fc8fc4ed966e2b07b07b6 (diff) | |
download | lwn-c8ec7067774748f29dae43682df884d329a7cb9e.tar.gz lwn-c8ec7067774748f29dae43682df884d329a7cb9e.zip |
[PATCH] ALSA: snd_rtctimer: handle RTC interrupts with a tasklet
The calls to rtc_control() from inside the interrupt handler can
deadlock the RTC code, so move our interrupt handling code to a tasklet.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
-rw-r--r-- | sound/core/rtctimer.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index 84704ccb1829..15b6c8a3f7db 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c @@ -50,7 +50,9 @@ static int rtctimer_stop(struct snd_timer *t); * The hardware dependent description for this timer. */ static struct snd_timer_hardware rtc_hw = { - .flags = SNDRV_TIMER_HW_FIRST|SNDRV_TIMER_HW_AUTO, + .flags = SNDRV_TIMER_HW_AUTO | + SNDRV_TIMER_HW_FIRST | + SNDRV_TIMER_HW_TASKLET, .ticks = 100000000L, /* FIXME: XXX */ .open = rtctimer_open, .close = rtctimer_close, @@ -60,6 +62,7 @@ static struct snd_timer_hardware rtc_hw = { static int rtctimer_freq = RTC_FREQ; /* frequency */ static struct snd_timer *rtctimer; +static struct tasklet_struct rtc_tasklet; static rtc_task_t rtc_task; @@ -81,6 +84,7 @@ rtctimer_close(struct snd_timer *t) rtc_task_t *rtc = t->private_data; if (rtc) { rtc_unregister(rtc); + tasklet_kill(&rtc_tasklet); t->private_data = NULL; } return 0; @@ -105,12 +109,17 @@ rtctimer_stop(struct snd_timer *timer) return 0; } +static void rtctimer_tasklet(unsigned long data) +{ + snd_timer_interrupt((struct snd_timer *)data, 1); +} + /* * interrupt */ static void rtctimer_interrupt(void *private_data) { - snd_timer_interrupt(private_data, 1); + tasklet_hi_schedule(private_data); } @@ -139,9 +148,11 @@ static int __init rtctimer_init(void) timer->hw = rtc_hw; timer->hw.resolution = NANO_SEC / rtctimer_freq; + tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer); + /* set up RTC callback */ rtc_task.func = rtctimer_interrupt; - rtc_task.private_data = timer; + rtc_task.private_data = &rtc_tasklet; err = snd_timer_global_register(timer); if (err < 0) { |