162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Trace files that want to automate creation of all tracepoints defined
462306a36Sopenharmony_ci * in their file should include this file. The following are macros that the
562306a36Sopenharmony_ci * trace file may define:
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * TRACE_SYSTEM defines the system the tracepoint is for
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
1062306a36Sopenharmony_ci *     This macro may be defined to tell define_trace.h what file to include.
1162306a36Sopenharmony_ci *     Note, leave off the ".h".
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
1462306a36Sopenharmony_ci *     then this macro can define the path to use. Note, the path is relative to
1562306a36Sopenharmony_ci *     define_trace.h, not the file including it. Full path names for out of tree
1662306a36Sopenharmony_ci *     modules must be used.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#ifdef CREATE_CUSTOM_TRACE_EVENTS
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* Prevent recursion */
2262306a36Sopenharmony_ci#undef CREATE_CUSTOM_TRACE_EVENTS
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#include <linux/stringify.h>
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#undef TRACE_CUSTOM_EVENT
2762306a36Sopenharmony_ci#define TRACE_CUSTOM_EVENT(name, proto, args, tstruct, assign, print)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#undef DEFINE_CUSTOM_EVENT
3062306a36Sopenharmony_ci#define DEFINE_CUSTOM_EVENT(template, name, proto, args)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#undef TRACE_INCLUDE
3362306a36Sopenharmony_ci#undef __TRACE_INCLUDE
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef TRACE_INCLUDE_FILE
3662306a36Sopenharmony_ci# define TRACE_INCLUDE_FILE TRACE_SYSTEM
3762306a36Sopenharmony_ci# define UNDEF_TRACE_INCLUDE_FILE
3862306a36Sopenharmony_ci#endif
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#ifndef TRACE_INCLUDE_PATH
4162306a36Sopenharmony_ci# define __TRACE_INCLUDE(system) <trace/events/system.h>
4262306a36Sopenharmony_ci# define UNDEF_TRACE_INCLUDE_PATH
4362306a36Sopenharmony_ci#else
4462306a36Sopenharmony_ci# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
4562306a36Sopenharmony_ci#endif
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* Let the trace headers be reread */
5062306a36Sopenharmony_ci#define TRACE_CUSTOM_MULTI_READ
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#ifdef TRACEPOINTS_ENABLED
5562306a36Sopenharmony_ci#include <trace/trace_custom_events.h>
5662306a36Sopenharmony_ci#endif
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#undef TRACE_CUSTOM_EVENT
5962306a36Sopenharmony_ci#undef DECLARE_CUSTOM_EVENT_CLASS
6062306a36Sopenharmony_ci#undef DEFINE_CUSTOM_EVENT
6162306a36Sopenharmony_ci#undef TRACE_CUSTOM_MULTI_READ
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* Only undef what we defined in this file */
6462306a36Sopenharmony_ci#ifdef UNDEF_TRACE_INCLUDE_FILE
6562306a36Sopenharmony_ci# undef TRACE_INCLUDE_FILE
6662306a36Sopenharmony_ci# undef UNDEF_TRACE_INCLUDE_FILE
6762306a36Sopenharmony_ci#endif
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#ifdef UNDEF_TRACE_INCLUDE_PATH
7062306a36Sopenharmony_ci# undef TRACE_INCLUDE_PATH
7162306a36Sopenharmony_ci# undef UNDEF_TRACE_INCLUDE_PATH
7262306a36Sopenharmony_ci#endif
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/* We may be processing more files */
7562306a36Sopenharmony_ci#define CREATE_CUSTOM_TRACE_POINTS
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci#endif /* CREATE_CUSTOM_TRACE_POINTS */
78