/* * ENTRY functions */ static int __init rtctimer_init(void) { int err; snd_timer_t *timer; 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; } /* Create a new timer and set up the fields */ err = snd_timer_global_new("rtc", SNDRV_TIMER_GLOBAL_RTC, &timer); 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; /* set up RTC callback */ rtc_task.func = rtctimer_interrupt; rtc_task.private_data = timer; err = snd_timer_global_register(timer); if (err < 0) { snd_timer_global_free(timer); return err; } rtctimer = timer; /* remember this */ return 0; }
static int __init rtctimer_init(void) { int err; struct snd_timer *timer; if (rtctimer_freq < 2 || rtctimer_freq > 8192 || !is_power_of_2(rtctimer_freq)) { snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); return -EINVAL; } /* */ err = snd_timer_global_new("rtc", SNDRV_TIMER_GLOBAL_RTC, &timer); 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; tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer); /* */ rtc_task.func = rtctimer_interrupt; rtc_task.private_data = &rtc_tasklet; err = snd_timer_global_register(timer); if (err < 0) { snd_timer_global_free(timer); return err; } rtctimer = timer; /* */ return 0; }