diff options
author | Nishanth Aravamudan <nacc@us.ibm.com> | 2005-09-03 18:56:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:06:01 -0400 |
commit | 0287ebedfa032a57bb47f4bc5cb5e268ecd844ad (patch) | |
tree | a30b87a024e4cedcc0fdcb242e7511f8a4c22aaf /arch/ppc64/kernel/scanlog.c | |
parent | 233ccd0d0452682edb51725410e0f8c0384e8b34 (diff) |
[PATCH] ppc64: replace schedule_timeout() with msleep_interruptible()
Use msleep_interruptible() instead of schedule_timeout() in ppc64-specific
code to cleanup/simplify the sleeping logic. Change the units of the
parameter of do_event_scan_all_cpus() to milliseconds from jiffies. The
return value of rtas_extended_busy_delay_time() was incorrectly being used
as a jiffies value (it is actually milliseconds), which is fixed by using
the value as a parameter to msleep_interruptible(). Also, use
rtas_extended_busy_delay_time() in another case where similar logic is
duplicated.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc64/kernel/scanlog.c')
-rw-r--r-- | arch/ppc64/kernel/scanlog.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/arch/ppc64/kernel/scanlog.c b/arch/ppc64/kernel/scanlog.c index 4d70736619c7..215bf8900304 100644 --- a/arch/ppc64/kernel/scanlog.c +++ b/arch/ppc64/kernel/scanlog.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/proc_fs.h> | 26 | #include <linux/proc_fs.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/delay.h> | ||
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/rtas.h> | 30 | #include <asm/rtas.h> |
30 | #include <asm/prom.h> | 31 | #include <asm/prom.h> |
@@ -77,7 +78,7 @@ static ssize_t scanlog_read(struct file *file, char __user *buf, | |||
77 | return -EFAULT; | 78 | return -EFAULT; |
78 | 79 | ||
79 | for (;;) { | 80 | for (;;) { |
80 | wait_time = HZ/2; /* default wait if no data */ | 81 | wait_time = 500; /* default wait if no data */ |
81 | spin_lock(&rtas_data_buf_lock); | 82 | spin_lock(&rtas_data_buf_lock); |
82 | memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE); | 83 | memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE); |
83 | status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, | 84 | status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, |
@@ -107,24 +108,14 @@ static ssize_t scanlog_read(struct file *file, char __user *buf, | |||
107 | break; | 108 | break; |
108 | default: | 109 | default: |
109 | if (status > 9900 && status <= 9905) { | 110 | if (status > 9900 && status <= 9905) { |
110 | /* No data. RTAS is hinting at a delay required | 111 | wait_time = rtas_extended_busy_delay_time(status); |
111 | * between 1-100000 milliseconds | ||
112 | */ | ||
113 | int ms = 1; | ||
114 | for (; status > 9900; status--) | ||
115 | ms = ms * 10; | ||
116 | /* Use microseconds for reasonable accuracy */ | ||
117 | ms *= 1000; | ||
118 | wait_time = ms / (1000000/HZ); /* round down is fine */ | ||
119 | /* Fall through to sleep */ | ||
120 | } else { | 112 | } else { |
121 | printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status); | 113 | printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status); |
122 | return -EIO; | 114 | return -EIO; |
123 | } | 115 | } |
124 | } | 116 | } |
125 | /* Apparently no data yet. Wait and try again. */ | 117 | /* Apparently no data yet. Wait and try again. */ |
126 | set_current_state(TASK_INTERRUPTIBLE); | 118 | msleep_interruptible(wait_time); |
127 | schedule_timeout(wait_time); | ||
128 | } | 119 | } |
129 | /*NOTREACHED*/ | 120 | /*NOTREACHED*/ |
130 | } | 121 | } |