Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751226AbdH1E5y (ORCPT ); Mon, 28 Aug 2017 00:57:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5473 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbdH1E5x (ORCPT ); Mon, 28 Aug 2017 00:57:53 -0400 From: Zhou Chengming To: , , CC: Subject: [PATCH] tracing: make dynamic types can use __TRACE_LAST_TYPE Date: Mon, 28 Aug 2017 12:59:08 +0800 Message-ID: <1503896348-134351-1-git-send-email-zhouchengming1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.59A3A2CB.0072,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 64144e6539f67566ffd583db56822d32 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1776 Lines: 63 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 --- 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