Re: Periodic event in Kernel Module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




This is exactly what I need. add_timer() calling function X in the
init
and then add_timer() in function X.



No, I believe you want to do add_timer() calling function X in the init
and then mod_timer() in function X (or del_timer() if your finished).

I based my statement on the code for kbleds.c at:
http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html

ie:

static int __init kbleds_init(void)
{
..
	init_timer(&my_timer);
	my_timer.function = my_timer_func;
	my_timer.data = (unsigned long)&kbledstatus;
	my_timer.expires = jiffies + BLINK_DELAY;
	add_timer(&my_timer);
	return 0;
}

static void my_timer_func(unsigned long ptr)
{
..
	my_timer.expires = jiffies + BLINK_DELAY;
	add_timer(&my_timer);
}


--
--------------------------------------------------
| Rick J. Blundell                               |
| <rickb@xxxxxxxxxxxx>                           |
--------------------------------------------------
| Mac OS X proves that it's easier to make UNIX  |
| pretty than it is to make Windows secure.      |
--------------------------------------------------

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux