diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-09-18 02:07:05 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-09-19 11:30:40 -0400 |
commit | 30bd39cd6244ffe3258c9203405286ef77b1c4eb (patch) | |
tree | db9227aa02a974283354e10650bdd372266fe0da /kernel | |
parent | ee6c2c1bd15e60a442d1861b66285f112ce4f25c (diff) |
tracing/events: use list_for_entry_continue
Simplify s_next() and t_next().
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AB32389.1030005@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_events.c | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 56c260b83a9c..6f03c8a1105e 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -271,42 +271,32 @@ ftrace_event_write(struct file *file, const char __user *ubuf, | |||
271 | static void * | 271 | static void * |
272 | t_next(struct seq_file *m, void *v, loff_t *pos) | 272 | t_next(struct seq_file *m, void *v, loff_t *pos) |
273 | { | 273 | { |
274 | struct list_head *list = m->private; | 274 | struct ftrace_event_call *call = v; |
275 | struct ftrace_event_call *call; | ||
276 | 275 | ||
277 | (*pos)++; | 276 | (*pos)++; |
278 | 277 | ||
279 | for (;;) { | 278 | list_for_each_entry_continue(call, &ftrace_events, list) { |
280 | if (list == &ftrace_events) | ||
281 | return NULL; | ||
282 | |||
283 | call = list_entry(list, struct ftrace_event_call, list); | ||
284 | |||
285 | /* | 279 | /* |
286 | * The ftrace subsystem is for showing formats only. | 280 | * The ftrace subsystem is for showing formats only. |
287 | * They can not be enabled or disabled via the event files. | 281 | * They can not be enabled or disabled via the event files. |
288 | */ | 282 | */ |
289 | if (call->regfunc) | 283 | if (call->regfunc) |
290 | break; | 284 | return call; |
291 | |||
292 | list = list->next; | ||
293 | } | 285 | } |
294 | 286 | ||
295 | m->private = list->next; | 287 | return NULL; |
296 | |||
297 | return call; | ||
298 | } | 288 | } |
299 | 289 | ||
300 | static void *t_start(struct seq_file *m, loff_t *pos) | 290 | static void *t_start(struct seq_file *m, loff_t *pos) |
301 | { | 291 | { |
302 | struct ftrace_event_call *call = NULL; | 292 | struct ftrace_event_call *call; |
303 | loff_t l; | 293 | loff_t l; |
304 | 294 | ||
305 | mutex_lock(&event_mutex); | 295 | mutex_lock(&event_mutex); |
306 | 296 | ||
307 | m->private = ftrace_events.next; | 297 | call = list_entry(&ftrace_events, struct ftrace_event_call, list); |
308 | for (l = 0; l <= *pos; ) { | 298 | for (l = 0; l <= *pos; ) { |
309 | call = t_next(m, NULL, &l); | 299 | call = t_next(m, call, &l); |
310 | if (!call) | 300 | if (!call) |
311 | break; | 301 | break; |
312 | } | 302 | } |
@@ -316,37 +306,28 @@ static void *t_start(struct seq_file *m, loff_t *pos) | |||
316 | static void * | 306 | static void * |
317 | s_next(struct seq_file *m, void *v, loff_t *pos) | 307 | s_next(struct seq_file *m, void *v, loff_t *pos) |
318 | { | 308 | { |
319 | struct list_head *list = m->private; | 309 | struct ftrace_event_call *call = v; |
320 | struct ftrace_event_call *call; | ||
321 | 310 | ||
322 | (*pos)++; | 311 | (*pos)++; |
323 | 312 | ||
324 | retry: | 313 | list_for_each_entry_continue(call, &ftrace_events, list) { |
325 | if (list == &ftrace_events) | 314 | if (call->enabled) |
326 | return NULL; | 315 | return call; |
327 | |||
328 | call = list_entry(list, struct ftrace_event_call, list); | ||
329 | |||
330 | if (!call->enabled) { | ||
331 | list = list->next; | ||
332 | goto retry; | ||
333 | } | 316 | } |
334 | 317 | ||
335 | m->private = list->next; | 318 | return NULL; |
336 | |||
337 | return call; | ||
338 | } | 319 | } |
339 | 320 | ||
340 | static void *s_start(struct seq_file *m, loff_t *pos) | 321 | static void *s_start(struct seq_file *m, loff_t *pos) |
341 | { | 322 | { |
342 | struct ftrace_event_call *call = NULL; | 323 | struct ftrace_event_call *call; |
343 | loff_t l; | 324 | loff_t l; |
344 | 325 | ||
345 | mutex_lock(&event_mutex); | 326 | mutex_lock(&event_mutex); |
346 | 327 | ||
347 | m->private = ftrace_events.next; | 328 | call = list_entry(&ftrace_events, struct ftrace_event_call, list); |
348 | for (l = 0; l <= *pos; ) { | 329 | for (l = 0; l <= *pos; ) { |
349 | call = s_next(m, NULL, &l); | 330 | call = s_next(m, call, &l); |
350 | if (!call) | 331 | if (!call) |
351 | break; | 332 | break; |
352 | } | 333 | } |