#include <linux/cdev.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
-#include <linux/timer.h>
+#include <linux/interrupt.h>
MODULE_LICENSE("GPL");
printk(KERN_INFO "%s", (char *) greeting);
}
-static DEFINE_TIMER(hello_timer, hello_world, 0, def_greeting);
+static DECLARE_TASKLET(hello_tasklet, hello_world, def_greeting);
static ssize_t hello_read(struct file *fp, char __user *buf, size_t sz,
loff_t *pos)
{
- printk(KERN_INFO "Adding timer...\n");
- hello_timer.expires = jiffies + 5 * HZ;
- add_timer(&hello_timer);
+ printk(KERN_INFO "Scheduling tasklet...\n");
+ tasklet_schedule(&hello_tasklet);
return 0;
}
static void __exit ch_exit(void)
{
- del_timer_sync(&hello_timer);
+ tasklet_kill(&hello_tasklet);
cdev_del(dev);
unregister_chrdev_region(devnum, 256);
}