Linux v4.15

This commit is contained in:
Ciro Santilli
2018-01-30 17:53:00 +00:00
parent 6b0f89a8b4
commit dc495f9334
5 changed files with 24 additions and 17 deletions

View File

@@ -1,4 +1,6 @@
/*
Print the jiffies every second.
Timers are callbacks that run when an interrupt happens, from the interrupt context itself.
Therefore they produce more accurate timing than thread scheduling, which is more complex,
@@ -15,12 +17,12 @@ See also:
#include <linux/module.h>
#include <linux/timer.h>
static void callback(unsigned long data);
static void callback(struct timer_list *data);
static unsigned long onesec;
DEFINE_TIMER(mytimer, callback, 0, 0);
DEFINE_TIMER(mytimer, callback);
static void callback(unsigned long data)
static void callback(struct timer_list *data)
{
pr_info("%u\n", (unsigned)jiffies);
mod_timer(&mytimer, jiffies + onesec);