mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing: make dynamic types can use __TRACE_LAST_TYPE
@ 2017-08-28  4:59 Zhou Chengming
  2017-08-28 11:01 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Zhou Chengming @ 2017-08-28  4:59 UTC (permalink / raw)
  To: linux-kernel, rostedt, mingo; +Cc: zhouchengming1

Obviously, trace_events that defined staticly in trace.h won't use
__TRACE_LAST_TYPE, so make dynamic types can use it. And some
minor changes to trace_search_list() to make code clearer.

Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
---
 kernel/trace/trace_output.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index bac629a..dcb146f 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -19,7 +19,7 @@
 
 static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
 
-static int next_event_type = __TRACE_LAST_TYPE + 1;
+static int next_event_type = __TRACE_LAST_TYPE;
 
 enum print_line_t trace_print_bputs_msg_only(struct trace_iterator *iter)
 {
@@ -696,7 +696,7 @@ static int trace_search_list(struct list_head **list)
 
 	if (list_empty(&ftrace_event_list)) {
 		*list = &ftrace_event_list;
-		return last + 1;
+		return last;
 	}
 
 	/*
@@ -704,17 +704,17 @@ static int trace_search_list(struct list_head **list)
 	 * lets see if somebody freed one.
 	 */
 	list_for_each_entry(e, &ftrace_event_list, list) {
-		if (e->type != last + 1)
+		if (e->type != last)
 			break;
 		last++;
 	}
 
 	/* Did we used up all 65 thousand events??? */
-	if ((last + 1) > TRACE_EVENT_TYPE_MAX)
+	if (last > TRACE_EVENT_TYPE_MAX)
 		return 0;
 
 	*list = &e->list;
-	return last + 1;
+	return last;
 }
 
 void trace_event_read_lock(void)
@@ -777,7 +777,7 @@ int register_trace_event(struct trace_event *event)
 
 		list_add_tail(&event->list, list);
 
-	} else if (event->type > __TRACE_LAST_TYPE) {
+	} else if (event->type >= __TRACE_LAST_TYPE) {
 		printk(KERN_WARNING "Need to add type to trace.h\n");
 		WARN_ON(1);
 		goto out;
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] tracing: make dynamic types can use __TRACE_LAST_TYPE
  2017-08-28  4:59 [PATCH] tracing: make dynamic types can use __TRACE_LAST_TYPE Zhou Chengming
@ 2017-08-28 11:01 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2017-08-28 11:01 UTC (permalink / raw)
  To: Zhou Chengming; +Cc: linux-kernel, mingo

On Mon, 28 Aug 2017 12:59:08 +0800
Zhou Chengming <zhouchengming1@huawei.com> wrote:

> Obviously, trace_events that defined staticly in trace.h won't use
> __TRACE_LAST_TYPE, so make dynamic types can use it. And some
> minor changes to trace_search_list() to make code clearer.

Is there some reason to do this? I'm not sure it makes the code any
clearer. It looks like churn for churn sake. Which means that it can
cause a bug, and requires a bit of work to verify it does not.

Now if there's other work that is being done that requires this change,
then I have no problem adding it. But if it is just to "make it
clearer" then no, I'm not adding it.

-- Steve

> 
> Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-28 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28  4:59 [PATCH] tracing: make dynamic types can use __TRACE_LAST_TYPE Zhou Chengming
2017-08-28 11:01 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®