xref: /linux/drivers/base/trace.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Device core Trace Support
4  * Copyright (C) 2021, Intel Corporation
5  *
6  * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7  */
8 
9 #undef TRACE_SYSTEM
10 #define TRACE_SYSTEM dev
11 
12 #if !defined(__DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
13 #define __DEV_TRACE_H
14 
15 #include <linux/device.h>
16 #include <linux/tracepoint.h>
17 #include <linux/types.h>
18 
19 DECLARE_EVENT_CLASS(devres,
20 	TP_PROTO(struct device *dev, const char *op, void *node, const char *name, size_t size),
21 	TP_ARGS(dev, op, node, name, size),
22 	TP_STRUCT__entry(
23 		__string(devname, dev_name(dev))
24 		__field(struct device *, dev)
25 		__field(const char *, op)
26 		__field(void *, node)
27 		__field(const char *, name)
28 		__field(size_t, size)
29 	),
30 	TP_fast_assign(
31 		__assign_str(devname);
32 		__entry->op = op;
33 		__entry->node = node;
34 		__entry->name = name;
35 		__entry->size = size;
36 	),
37 	TP_printk("%s %3s %p %s (%zu bytes)", __get_str(devname),
38 		  __entry->op, __entry->node, __entry->name, __entry->size)
39 );
40 
41 DEFINE_EVENT(devres, devres_log,
42 	TP_PROTO(struct device *dev, const char *op, void *node, const char *name, size_t size),
43 	TP_ARGS(dev, op, node, name, size)
44 );
45 
46 #endif /* __DEV_TRACE_H */
47 
48 /* this part has to be here */
49 
50 #undef TRACE_INCLUDE_PATH
51 #define TRACE_INCLUDE_PATH .
52 
53 #undef TRACE_INCLUDE_FILE
54 #define TRACE_INCLUDE_FILE trace
55 
56 #include <trace/define_trace.h>
57