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