projects
/
cascardo
/
kernel
/
samples
/
char2
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Using udelay to busy wait for about 10 seconds.
[cascardo/kernel/samples/char2/.git]
/
hellochar.c
diff --git
a/hellochar.c
b/hellochar.c
index
a197a1d
..
7f659f5
100644
(file)
--- a/
hellochar.c
+++ b/
hellochar.c
@@
-39,9
+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)
{
-
unsigned long expire = jiffies + 5 * HZ
;
- while (
time_after(expire, jiffies)
)
-
cpu_relax(
);
+
int i = 1 << 20
;
+ while (
i--
)
+
udelay(10
);
return 0;
}