diff options
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 | } |