summaryrefslogtreecommitdiff
path: root/drivers/base/trace.h
blob: 3192e18f877ed00deb4bdd4f701d06d15aaeed95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Device core Trace Support
 * Copyright (C) 2021, Intel Corporation
 *
 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM dev

#if !defined(__DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define __DEV_TRACE_H

#include <linux/device.h>
#include <linux/tracepoint.h>
#include <linux/types.h>

DECLARE_EVENT_CLASS(devres,
	TP_PROTO(struct device *dev, const char *op, void *node, const char *name, size_t size),
	TP_ARGS(dev, op, node, name, size),
	TP_STRUCT__entry(
		__string(devname, dev_name(dev))
		__field(struct device *, dev)
		__field(const char *, op)
		__field(void *, node)
		__field(const char *, name)
		__field(size_t, size)
	),
	TP_fast_assign(
		__assign_str(devname, dev_name(dev));
		__entry->op = op;
		__entry->node = node;
		__entry->name = name;
		__entry->size = size;
	),
	TP_printk("%s %3s %p %s (%zu bytes)", __get_str(devname),
		  __entry->op, __entry->node, __entry->name, __entry->size)
);

DEFINE_EVENT(devres, devres_log,
	TP_PROTO(struct device *dev, const char *op, void *node, const char *name, size_t size),
	TP_ARGS(dev, op, node, name, size)
);

#endif /* __DEV_TRACE_H */

/* this part has to be here */

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .

#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace

#include <trace/define_trace.h>