diff options
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index bdedbee85c01..7c7f4b856bad 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -2565,6 +2565,14 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, | |||
2565 | int try; | 2565 | int try; |
2566 | s32 res; | 2566 | s32 res; |
2567 | 2567 | ||
2568 | /* If enabled, the following two tracepoints are conditional on | ||
2569 | * read_write and protocol. | ||
2570 | */ | ||
2571 | trace_smbus_write(adapter, addr, flags, read_write, | ||
2572 | command, protocol, data); | ||
2573 | trace_smbus_read(adapter, addr, flags, read_write, | ||
2574 | command, protocol); | ||
2575 | |||
2568 | flags &= I2C_M_TEN | I2C_CLIENT_PEC | I2C_CLIENT_SCCB; | 2576 | flags &= I2C_M_TEN | I2C_CLIENT_PEC | I2C_CLIENT_SCCB; |
2569 | 2577 | ||
2570 | if (adapter->algo->smbus_xfer) { | 2578 | if (adapter->algo->smbus_xfer) { |
@@ -2585,15 +2593,24 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, | |||
2585 | i2c_unlock_adapter(adapter); | 2593 | i2c_unlock_adapter(adapter); |
2586 | 2594 | ||
2587 | if (res != -EOPNOTSUPP || !adapter->algo->master_xfer) | 2595 | if (res != -EOPNOTSUPP || !adapter->algo->master_xfer) |
2588 | return res; | 2596 | goto trace; |
2589 | /* | 2597 | /* |
2590 | * Fall back to i2c_smbus_xfer_emulated if the adapter doesn't | 2598 | * Fall back to i2c_smbus_xfer_emulated if the adapter doesn't |
2591 | * implement native support for the SMBus operation. | 2599 | * implement native support for the SMBus operation. |
2592 | */ | 2600 | */ |
2593 | } | 2601 | } |
2594 | 2602 | ||
2595 | return i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, | 2603 | res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, |
2596 | command, protocol, data); | 2604 | command, protocol, data); |
2605 | |||
2606 | trace: | ||
2607 | /* If enabled, the reply tracepoint is conditional on read_write. */ | ||
2608 | trace_smbus_reply(adapter, addr, flags, read_write, | ||
2609 | command, protocol, data); | ||
2610 | trace_smbus_result(adapter, addr, flags, read_write, | ||
2611 | command, protocol, res); | ||
2612 | |||
2613 | return res; | ||
2597 | } | 2614 | } |
2598 | EXPORT_SYMBOL(i2c_smbus_xfer); | 2615 | EXPORT_SYMBOL(i2c_smbus_xfer); |
2599 | 2616 | ||