From 014bb573eed1a3f9c907a4ae6186834e98dbb85c Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Thu, 20 May 2010 16:22:43 -0400 Subject: [PATCH] Wait 5 seconds testing for jiffies. --- hellochar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hellochar.c b/hellochar.c index 206b6d1..a197a1d 100644 --- a/hellochar.c +++ b/hellochar.c @@ -21,6 +21,7 @@ #include #include #include +#include MODULE_LICENSE("GPL"); @@ -38,11 +39,9 @@ static int hello_open(struct inode *ino, struct file *fp) static ssize_t hello_read(struct file *fp, char __user *buf, size_t sz, loff_t *pos) { - int i = 1 << 28; - spin_lock(&hello_lock); - while (i--) + unsigned long expire = jiffies + 5 * HZ; + while (time_after(expire, jiffies)) cpu_relax(); - spin_unlock(&hello_lock); return 0; } -- 2.20.1