commit ac5d1a7d253f3c02d1e5c93edfa26e81466ec71e
tree 629e4d8618d11233c2e24daf28aa12f055dc24c3
parent 2ea5814472c3c910aed5c5b60f1f3b1000e353f1
author Clemens Ladisch <[EMAIL PROTECTED]> 1161938700 +0200
committer Jaroslav Kysela <[EMAIL PROTECTED]> 1164717993 +0100

[ALSA] rtctimer: handle RTC interrupts with a tasklet

The calls to rtc_control() from inside the interrupt handler can upset
the RTC code, so move our interrupt handling code to a tasklet.

Signed-off-by: Clemens Ladisch <[EMAIL PROTECTED]>
Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>

 sound/core/rtctimer.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
index 412dd62..9f7b32e 100644
--- a/sound/core/rtctimer.c
+++ b/sound/core/rtctimer.c
@@ -22,13 +22,10 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
-#include <linux/time.h>
-#include <linux/threads.h>
 #include <linux/interrupt.h>
 #include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/timer.h>
-#include <sound/info.h>
 
 #if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE)
 
@@ -50,7 +47,9 @@ static int rtctimer_stop(struct snd_time
  * 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 +59,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 +81,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 +106,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 +145,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) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to