diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 19:09:02 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 19:09:02 +0300 |
commit | 8f0cb147b2fb12427bf6abef7fed2b604557a41e (patch) | |
tree | fb5ba437ee74b900fab9686c8c7df18abcd7640b /sound/core/rtctimer.c | |
parent | 8e33ba49765484bc6de3a2f8143733713fa93bc1 (diff) | |
parent | b00e8443c3eece823052d06ae1c7cb797ab0ddf5 (diff) | |
download | linux-8f0cb147b2fb12427bf6abef7fed2b604557a41e.tar.xz |
Merge master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
Diffstat (limited to 'sound/core/rtctimer.c')
-rw-r--r-- | sound/core/rtctimer.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index bd5d584d284d..c3c18568207e 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c @@ -60,7 +60,6 @@ static struct _snd_timer_hardware rtc_hw = { static int rtctimer_freq = RTC_FREQ; /* frequency */ static snd_timer_t *rtctimer; -static atomic_t rtc_inc = ATOMIC_INIT(0); static rtc_task_t rtc_task; @@ -94,7 +93,6 @@ rtctimer_start(snd_timer_t *timer) snd_assert(rtc != NULL, return -EINVAL); rtc_control(rtc, RTC_IRQP_SET, rtctimer_freq); rtc_control(rtc, RTC_PIE_ON, 0); - atomic_set(&rtc_inc, 0); return 0; } @@ -112,12 +110,7 @@ rtctimer_stop(snd_timer_t *timer) */ static void rtctimer_interrupt(void *private_data) { - int ticks; - - atomic_inc(&rtc_inc); - ticks = atomic_read(&rtc_inc); - snd_timer_interrupt((snd_timer_t*)private_data, ticks); - atomic_sub(ticks, &rtc_inc); + snd_timer_interrupt(private_data, 1); } @@ -126,17 +119,13 @@ static void rtctimer_interrupt(void *private_data) */ static int __init rtctimer_init(void) { - int order, err; + int err; snd_timer_t *timer; - if (rtctimer_freq < 2 || rtctimer_freq > 8192) { - snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); - return -EINVAL; - } - for (order = 1; rtctimer_freq > order; order <<= 1) - ; - if (rtctimer_freq != order) { - snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); + if (rtctimer_freq < 2 || rtctimer_freq > 8192 || + (rtctimer_freq & (rtctimer_freq - 1)) != 0) { + snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", + rtctimer_freq); return -EINVAL; } @@ -145,6 +134,7 @@ static int __init rtctimer_init(void) if (err < 0) return err; + timer->module = THIS_MODULE; strcpy(timer->name, "RTC timer"); timer->hw = rtc_hw; timer->hw.resolution = NANO_SEC / rtctimer_freq; |