timer problem
From: Daniel Baluta <hidden>
Date: 2011-07-07 09:18:08
On Wed, Jul 6, 2011 at 11:48 PM, Daniel Baluta [off-list ref] wrote:
Hello Prashant,quoted
struct timer_list tim; void timfunc(unsigned long data) {[..]quoted
? ? ? ?schedule_timeout(10 * HZ);[..]quoted
} static int __init init_testmod(void) { ? ? ? ?init_timer(&tim); ? ? ? ?tim.expires = jiffies + HZ*5; ? ? ? ?tim.data = 1000; ? ? ? ?tim.function = timfunc; ? ? ? ?add_timer(&tim); ? ? ? ?return 0; }You can find here ([1]) a good source for documenting on kernel timers API. Basically, the kernel has a list with registered timers and runs the associated handlers when timeout expires. Looking at your code, you've initialized the timer but you didn't added it to kernel timers list. You can find here a simple example of how to setup a timer ([2]).
Oh, so it seems you called add_timer :D, I just missed it. Then the problem is the one pointed below (schedule_timeout called in interrupt context).
Please read this [3], and figure out why even after you'll correctly setup the timer, your timer handler will cause you trouble.