1 /* SPDX-License-Identifier: GPL-2.0-or-later * 1 2 /* I2C message transfer tracepoints 3 * 4 * Copyright (C) 2013 Red Hat, Inc. All Rights 5 * Written by David Howells (dhowells@redhat.c 6 */ 7 #undef TRACE_SYSTEM 8 #define TRACE_SYSTEM i2c 9 10 #if !defined(_TRACE_I2C_H) || defined(TRACE_HE 11 #define _TRACE_I2C_H 12 13 #include <linux/i2c.h> 14 #include <linux/tracepoint.h> 15 16 /* 17 * drivers/i2c/i2c-core-base.c 18 */ 19 extern int i2c_transfer_trace_reg(void); 20 extern void i2c_transfer_trace_unreg(void); 21 22 /* 23 * __i2c_transfer() write request 24 */ 25 TRACE_EVENT_FN(i2c_write, 26 TP_PROTO(const struct i2c_adapt 27 int num), 28 TP_ARGS(adap, msg, num), 29 TP_STRUCT__entry( 30 __field(int, adapte 31 __field(__u16, msg_nr 32 __field(__u16, addr 33 __field(__u16, flags 34 __field(__u16, len 35 __dynamic_array(__u8, b 36 TP_fast_assign( 37 __entry->adapter_nr = a 38 __entry->msg_nr = num; 39 __entry->addr = msg->ad 40 __entry->flags = msg->f 41 __entry->len = msg->len 42 memcpy(__get_dynamic_ar 43 ), 44 TP_printk("i2c-%d #%u a=%03x f= 45 __entry->adapter_nr, 46 __entry->msg_nr, 47 __entry->addr, 48 __entry->flags, 49 __entry->len, 50 __entry->len, __get_d 51 ), 52 i2c_transfer_trace_reg, 53 i2c_transfer_trace_unreg); 54 55 /* 56 * __i2c_transfer() read request 57 */ 58 TRACE_EVENT_FN(i2c_read, 59 TP_PROTO(const struct i2c_adapt 60 int num), 61 TP_ARGS(adap, msg, num), 62 TP_STRUCT__entry( 63 __field(int, adapte 64 __field(__u16, msg_nr 65 __field(__u16, addr 66 __field(__u16, flags 67 __field(__u16, len 68 ), 69 TP_fast_assign( 70 __entry->adapter_nr = a 71 __entry->msg_nr = num; 72 __entry->addr = msg->ad 73 __entry->flags = msg->f 74 __entry->len = msg->len 75 ), 76 TP_printk("i2c-%d #%u a=%03x f= 77 __entry->adapter_nr, 78 __entry->msg_nr, 79 __entry->addr, 80 __entry->flags, 81 __entry->len 82 ), 83 i2c_transfer_trace_reg, 84 i2c_transfer_trace_unre 85 86 /* 87 * __i2c_transfer() read reply 88 */ 89 TRACE_EVENT_FN(i2c_reply, 90 TP_PROTO(const struct i2c_adapt 91 int num), 92 TP_ARGS(adap, msg, num), 93 TP_STRUCT__entry( 94 __field(int, adapte 95 __field(__u16, msg_nr 96 __field(__u16, addr 97 __field(__u16, flags 98 __field(__u16, len 99 __dynamic_array(__u8, b 100 TP_fast_assign( 101 __entry->adapter_nr = a 102 __entry->msg_nr = num; 103 __entry->addr = msg->ad 104 __entry->flags = msg->f 105 __entry->len = msg->len 106 memcpy(__get_dynamic_ar 107 ), 108 TP_printk("i2c-%d #%u a=%03x f= 109 __entry->adapter_nr, 110 __entry->msg_nr, 111 __entry->addr, 112 __entry->flags, 113 __entry->len, 114 __entry->len, __get_d 115 ), 116 i2c_transfer_trace_reg, 117 i2c_transfer_trace_unreg); 118 119 /* 120 * __i2c_transfer() result 121 */ 122 TRACE_EVENT_FN(i2c_result, 123 TP_PROTO(const struct i2c_adapt 124 TP_ARGS(adap, num, ret), 125 TP_STRUCT__entry( 126 __field(int, adapte 127 __field(__u16, nr_msg 128 __field(__s16, ret 129 ), 130 TP_fast_assign( 131 __entry->adapter_nr = a 132 __entry->nr_msgs = num; 133 __entry->ret = ret; 134 ), 135 TP_printk("i2c-%d n=%u ret=%d", 136 __entry->adapter_nr, 137 __entry->nr_msgs, 138 __entry->ret 139 ), 140 i2c_transfer_trace_reg, 141 i2c_transfer_trace_unreg); 142 143 #endif /* _TRACE_I2C_H */ 144 145 /* This part must be outside protection */ 146 #include <trace/define_trace.h> 147
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.