diff options
author | Jae Hyun Yoo <quic_jaehyoo@quicinc.com> | 2022-03-18 13:41:33 -0700 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2022-03-20 00:11:05 +0100 |
commit | d714fb25e755ad96b699993fac47f48c4d6cebe9 (patch) | |
tree | 22bfadf68977db34ed737f3809b5a249ae448f1d /include/linux/i2c.h | |
parent | 3364c0ef8732694084f8238ffd9c62819209fd7f (diff) |
i2c: add tracepoints for I2C slave events
I2C slave events tracepoints can be enabled by:
echo 1 > /sys/kernel/tracing/events/i2c_slave/enable
and logs in /sys/kernel/tracing/trace will look like:
... i2c_slave: i2c-0 a=010 ret=0 WR_REQ []
... i2c_slave: i2c-0 a=010 ret=0 WR_RCV [02]
... i2c_slave: i2c-0 a=010 ret=0 WR_RCV [0c]
... i2c_slave: i2c-0 a=010 ret=0 STOP []
... i2c_slave: i2c-0 a=010 ret=0 RD_REQ [04]
... i2c_slave: i2c-0 a=010 ret=0 RD_PRO [b4]
... i2c_slave: i2c-0 a=010 ret=0 STOP []
formatted as:
i2c-<adapter_nr>
a=<addr>
ret=<ret> <- callback return value
<event>
[<data>]
trace printings can be selected by adding a filter like:
echo adapter_nr==1 >/sys/kernel/tracing/events/i2c_slave/filter
Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 7d4f52ceb7b5..fbda5ada2afc 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -392,12 +392,8 @@ enum i2c_slave_event { int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); int i2c_slave_unregister(struct i2c_client *client); bool i2c_detect_slave_mode(struct device *dev); - -static inline int i2c_slave_event(struct i2c_client *client, - enum i2c_slave_event event, u8 *val) -{ - return client->slave_cb(client, event, val); -} +int i2c_slave_event(struct i2c_client *client, + enum i2c_slave_event event, u8 *val); #else static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } #endif |