diff options
Diffstat (limited to 'kernel/trace/trace_stack.c')
-rw-r--r-- | kernel/trace/trace_stack.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 0da1cff08d67..0f6facb050a1 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c | |||
@@ -186,43 +186,33 @@ static const struct file_operations stack_max_size_fops = { | |||
186 | }; | 186 | }; |
187 | 187 | ||
188 | static void * | 188 | static void * |
189 | t_next(struct seq_file *m, void *v, loff_t *pos) | 189 | __next(struct seq_file *m, loff_t *pos) |
190 | { | 190 | { |
191 | long i; | 191 | long n = *pos - 1; |
192 | 192 | ||
193 | (*pos)++; | 193 | if (n >= max_stack_trace.nr_entries || stack_dump_trace[n] == ULONG_MAX) |
194 | |||
195 | if (v == SEQ_START_TOKEN) | ||
196 | i = 0; | ||
197 | else { | ||
198 | i = *(long *)v; | ||
199 | i++; | ||
200 | } | ||
201 | |||
202 | if (i >= max_stack_trace.nr_entries || | ||
203 | stack_dump_trace[i] == ULONG_MAX) | ||
204 | return NULL; | 194 | return NULL; |
205 | 195 | ||
206 | m->private = (void *)i; | 196 | m->private = (void *)n; |
207 | |||
208 | return &m->private; | 197 | return &m->private; |
209 | } | 198 | } |
210 | 199 | ||
211 | static void *t_start(struct seq_file *m, loff_t *pos) | 200 | static void * |
201 | t_next(struct seq_file *m, void *v, loff_t *pos) | ||
212 | { | 202 | { |
213 | void *t = SEQ_START_TOKEN; | 203 | (*pos)++; |
214 | loff_t l = 0; | 204 | return __next(m, pos); |
205 | } | ||
215 | 206 | ||
207 | static void *t_start(struct seq_file *m, loff_t *pos) | ||
208 | { | ||
216 | local_irq_disable(); | 209 | local_irq_disable(); |
217 | __raw_spin_lock(&max_stack_lock); | 210 | __raw_spin_lock(&max_stack_lock); |
218 | 211 | ||
219 | if (*pos == 0) | 212 | if (*pos == 0) |
220 | return SEQ_START_TOKEN; | 213 | return SEQ_START_TOKEN; |
221 | 214 | ||
222 | for (; t && l < *pos; t = t_next(m, t, &l)) | 215 | return __next(m, pos); |
223 | ; | ||
224 | |||
225 | return t; | ||
226 | } | 216 | } |
227 | 217 | ||
228 | static void t_stop(struct seq_file *m, void *p) | 218 | static void t_stop(struct seq_file *m, void *p) |