Add I2C statistics (transaction, bus error and NACK counts) as sysfs attributes for a stable and unified API. The motivation is monitoring large numbers of BMCs at scale. Monitoring will be done using OpenBMC, which includes a Redfish implementation (bmcweb) and runs on different SoCs. OpenBMC has distribution-wide DBus C++ bindings, for which I2C statistics will be added. For the Redfish schemas, the upcoming Release 2021.4 will include I2C statistics too. Since both OpenBMC and Redfish have/will have committed to stable APIs for monitoring I2C statistics, we would like to learn the kernel community's opinion on stable kernel APIs for I2C counters. A more detailed explanation could be found in [1]. This version (v3) fixes format errors, potential unchecked memory allocation, and fixes a build problem found by the Kernel Test Robot. Thanks! [1] https://lore.kernel.org/lkml/CAJOps0u=seskB-YGvLBsHantJohkEX7do-mt7YSZ6zChQMQxbg@xxxxxxxxxxxxxx/ Sui Chen (2): i2c debug counters as sysfs attributes add npcm7xx debug counters as sysfs attributes Tali Perry (1): i2c: npcm7xx: add tx_complete counter drivers/i2c/busses/i2c-npcm7xx.c | 13 ++++ drivers/i2c/i2c-core-base.c | 23 ++++++ drivers/i2c/i2c-dev.c | 124 +++++++++++++++++++++++++++++++ include/linux/i2c.h | 28 +++++++ 4 files changed, 188 insertions(+) -- 2.34.1.307.g9b7440fafd-goog