<div dir="ltr">try to remove mytimer from stack<br><br><div class="gmail_quote">On Mon, Dec 20, 2010 at 10:27 AM, lijin liu <span dir="ltr"><<a href="mailto:llj098@gmail.com">llj098@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello everyone!<br>
<br>
I want to use the timer in my kernel module. I read the book _Linux<br>
kernel development 3rd version_ and LDD 3rd version.<br>
<br>
Both the two books tell me write the code like this:<br>
<br>
struct timer_list my_timer;<br>
init_timer(&my_timer);<br>
<br>
my_timer.expires = jiffies + wait;<br>
my_timer.data = 0;<br>
my_timer.function=my_function;<br>
<br>
//active the timer:<br>
add_timer(&timer);<br>
<br>
<br>
When I insmod the module, the kernel crashed, and when I change my<br>
code to *mod_timer* rather than add_timer.<br>
<br>
It just works!<br>
<br>
But why the add_timer crash the kernel?<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div>