* [PATCH] tracing/filters: use list_for_each_entry_safe
@ 2009-03-23 8:26 Tom Zanussi
2009-03-23 8:30 ` Li Zefan
2009-03-23 8:31 ` [tip:tracing/filters] " Tom Zanussi
0 siblings, 2 replies; 4+ messages in thread
From: Tom Zanussi @ 2009-03-23 8:26 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Steven Rostedt, Frédéric Weisbecker
Use list_for_each_entry_safe instead of list_for_each_entry in
find_event_field().
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/trace_events_filter.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 1ab20ce..c4a413b 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -147,11 +147,9 @@ int filter_print_preds(struct filter_pred **preds, char *buf)
static struct ftrace_event_field *
find_event_field(struct ftrace_event_call *call, char *name)
{
- struct ftrace_event_field *field;
- struct list_head *entry, *tmp;
+ struct ftrace_event_field *field, *next;
- list_for_each_safe(entry, tmp, &call->fields) {
- field = list_entry(entry, struct ftrace_event_field, link);
+ list_for_each_entry_safe(field, next, &call->fields, link) {
if (!strcmp(field->name, name))
return field;
}
--
1.5.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing/filters: use list_for_each_entry_safe
2009-03-23 8:26 [PATCH] tracing/filters: use list_for_each_entry_safe Tom Zanussi
@ 2009-03-23 8:30 ` Li Zefan
2009-03-23 8:33 ` Ingo Molnar
2009-03-23 8:31 ` [tip:tracing/filters] " Tom Zanussi
1 sibling, 1 reply; 4+ messages in thread
From: Li Zefan @ 2009-03-23 8:30 UTC (permalink / raw)
To: Tom Zanussi
Cc: linux-kernel, Ingo Molnar, Steven Rostedt,
Frédéric Weisbecker
> - list_for_each_safe(entry, tmp, &call->fields) {
> - field = list_entry(entry, struct ftrace_event_field, link);
> + list_for_each_entry_safe(field, next, &call->fields, link) {
Why we need _safe version ?
> if (!strcmp(field->name, name))
> return field;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:tracing/filters] tracing/filters: use list_for_each_entry_safe
2009-03-23 8:26 [PATCH] tracing/filters: use list_for_each_entry_safe Tom Zanussi
2009-03-23 8:30 ` Li Zefan
@ 2009-03-23 8:31 ` Tom Zanussi
1 sibling, 0 replies; 4+ messages in thread
From: Tom Zanussi @ 2009-03-23 8:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, fweisbec, tzanussi, rostedt, tglx,
mingo
Commit-ID: 75c8b417526529d0a7072e4d93ec99dbd483a6f4
Gitweb: http://git.kernel.org/tip/75c8b417526529d0a7072e4d93ec99dbd483a6f4
Author: Tom Zanussi <tzanussi@gmail.com>
AuthorDate: Mon, 23 Mar 2009 03:26:28 -0500
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 23 Mar 2009 09:28:07 +0100
tracing/filters: use list_for_each_entry_safe
Impact: cleanup
Use list_for_each_entry_safe instead of list_for_each_entry in
find_event_field().
Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1237796788.7527.35.camel@charm-linux>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/trace/trace_events_filter.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 1ab20ce..c4a413b 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -147,11 +147,9 @@ int filter_print_preds(struct filter_pred **preds, char *buf)
static struct ftrace_event_field *
find_event_field(struct ftrace_event_call *call, char *name)
{
- struct ftrace_event_field *field;
- struct list_head *entry, *tmp;
+ struct ftrace_event_field *field, *next;
- list_for_each_safe(entry, tmp, &call->fields) {
- field = list_entry(entry, struct ftrace_event_field, link);
+ list_for_each_entry_safe(field, next, &call->fields, link) {
if (!strcmp(field->name, name))
return field;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing/filters: use list_for_each_entry_safe
2009-03-23 8:30 ` Li Zefan
@ 2009-03-23 8:33 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-03-23 8:33 UTC (permalink / raw)
To: Li Zefan
Cc: Tom Zanussi, linux-kernel, Steven Rostedt,
Frédéric Weisbecker
* Li Zefan <lizf@cn.fujitsu.com> wrote:
> > - list_for_each_safe(entry, tmp, &call->fields) {
> > - field = list_entry(entry, struct ftrace_event_field, link);
> > + list_for_each_entry_safe(field, next, &call->fields, link) {
>
> Why we need _safe version ?
indeed the plain list_for_each_entry() variant would be fine, as the
list is only walked, not modified:
> > if (!strcmp(field->name, name))
> > return field;
> > }
(I've applied this patch already as it was a step forward - so
please enhance this in the next round of cleanups via a delta patch
- thanks!)
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-23 8:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23 8:26 [PATCH] tracing/filters: use list_for_each_entry_safe Tom Zanussi
2009-03-23 8:30 ` Li Zefan
2009-03-23 8:33 ` Ingo Molnar
2009-03-23 8:31 ` [tip:tracing/filters] " Tom Zanussi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox