#include <linux/module.h>

 #include <linux/kernel.h>
#include <linux/hrtimer.h>
#include <linux/jiffies.h> static struct hrtimer timer;
ktime_t kt; static enum hrtimer_restart hrtimer_hander(struct hrtimer *timer)
{
printk("zbzhuang:I am in hrtimer hander\r\n"); hrtimer_forward(timer,timer->base->get_time(),kt); return HRTIMER_RESTART; } static int __init test_init(void)
{
printk("zbzhuang:---------%s-----------\r\n",__func__); kt = ktime_set(,);
hrtimer_init(&timer,CLOCK_MONOTONIC,HRTIMER_MODE_REL);
hrtimer_start(&timer,kt,HRTIMER_MODE_REL);
timer.function = hrtimer_hander; return ;
} static void __exit test_exit(void)
{
hrtimer_cancel(&timer);
printk("zbzhuang------------test over---------------\r\n");
} module_init(test_init);
module_exit(test_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("[email protected]");
04-28 23:44