Commit 746cf345 authored by Wei Yang's avatar Wei Yang Committed by Steven Rostedt (VMware)
Browse files

tracing: Simplify defining of the next event id

The value to be used and compared in trace_search_list() is "last + 1".
Let's just define next to be "last + 1" instead of doing the addition
each time.

Link: https://lkml.kernel.org/r/20200703020612.12930-2-richard.weiyang@linux.alibaba.com



Signed-off-by: default avatarWei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 29ce2451
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -675,11 +675,11 @@ static LIST_HEAD(ftrace_event_list);
static int trace_search_list(struct list_head **list)
{
	struct trace_event *e;
	int last = __TRACE_LAST_TYPE;
	int next = __TRACE_LAST_TYPE + 1;

	if (list_empty(&ftrace_event_list)) {
		*list = &ftrace_event_list;
		return last + 1;
		return next;
	}

	/*
@@ -687,17 +687,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 != next)
			break;
		last++;
		next++;
	}

	/* Did we used up all 65 thousand events??? */
	if ((last + 1) > TRACE_EVENT_TYPE_MAX)
	if (next > TRACE_EVENT_TYPE_MAX)
		return 0;

	*list = &e->list;
	return last + 1;
	return next;
}

void trace_event_read_lock(void)