drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / input / keyboard / applespi_trace.h
blob0ad1a3d79f5030d6916c2e0263b46cd9c53a57e6
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * MacBook (Pro) SPI keyboard and touchpad driver
5 * Copyright (c) 2015-2019 Federico Lorenzi
6 * Copyright (c) 2017-2019 Ronald Tschalär
7 */
9 #undef TRACE_SYSTEM
10 #define TRACE_SYSTEM applespi
12 #if !defined(_APPLESPI_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
13 #define _APPLESPI_TRACE_H_
15 #include <linux/types.h>
16 #include <linux/tracepoint.h>
18 #include "applespi.h"
20 DECLARE_EVENT_CLASS(dump_message_template,
21 TP_PROTO(enum applespi_evt_type evt_type,
22 enum applespi_pkt_type pkt_type,
23 u8 *buf,
24 size_t len),
26 TP_ARGS(evt_type, pkt_type, buf, len),
28 TP_STRUCT__entry(
29 __field(enum applespi_evt_type, evt_type)
30 __field(enum applespi_pkt_type, pkt_type)
31 __field(size_t, len)
32 __dynamic_array(u8, buf, len)
35 TP_fast_assign(
36 __entry->evt_type = evt_type;
37 __entry->pkt_type = pkt_type;
38 __entry->len = len;
39 memcpy(__get_dynamic_array(buf), buf, len);
42 TP_printk("%-6s: %s",
43 __print_symbolic(__entry->pkt_type,
44 { PT_READ, "read" },
45 { PT_WRITE, "write" },
46 { PT_STATUS, "status" }
48 __print_hex(__get_dynamic_array(buf), __entry->len))
51 #define DEFINE_DUMP_MESSAGE_EVENT(name) \
52 DEFINE_EVENT(dump_message_template, name, \
53 TP_PROTO(enum applespi_evt_type evt_type, \
54 enum applespi_pkt_type pkt_type, \
55 u8 *buf, \
56 size_t len), \
57 TP_ARGS(evt_type, pkt_type, buf, len) \
60 DEFINE_DUMP_MESSAGE_EVENT(applespi_tp_ini_cmd);
61 DEFINE_DUMP_MESSAGE_EVENT(applespi_backlight_cmd);
62 DEFINE_DUMP_MESSAGE_EVENT(applespi_caps_lock_cmd);
63 DEFINE_DUMP_MESSAGE_EVENT(applespi_keyboard_data);
64 DEFINE_DUMP_MESSAGE_EVENT(applespi_touchpad_data);
65 DEFINE_DUMP_MESSAGE_EVENT(applespi_unknown_data);
66 DEFINE_DUMP_MESSAGE_EVENT(applespi_bad_crc);
68 TRACE_EVENT(applespi_irq_received,
69 TP_PROTO(enum applespi_evt_type evt_type,
70 enum applespi_pkt_type pkt_type),
72 TP_ARGS(evt_type, pkt_type),
74 TP_STRUCT__entry(
75 __field(enum applespi_evt_type, evt_type)
76 __field(enum applespi_pkt_type, pkt_type)
79 TP_fast_assign(
80 __entry->evt_type = evt_type;
81 __entry->pkt_type = pkt_type;
84 "\n"
87 #endif /* _APPLESPI_TRACE_H_ */
89 /* This part must be outside protection */
90 #undef TRACE_INCLUDE_PATH
91 #define TRACE_INCLUDE_PATH ../../drivers/input/keyboard
92 #define TRACE_INCLUDE_FILE applespi_trace
93 #include <trace/define_trace.h>