* [RFC Patch Resend 0/2] I2C statistics as sysfs attributes
@ 2021-11-09 22:53 ` Sui Chen
0 siblings, 0 replies; 7+ messages in thread
From: Sui Chen @ 2021-11-09 22:53 UTC (permalink / raw)
To: linux-kernel
Cc: Benjamin Fair, Andrew Jeffery, OpenBMC Mailing List, Tali Perry,
Josh Lehan, Sui Chen, linux-i2c
Add I2C statistics such as Bus Error counts and NACK counts as sysfs
attributes.
I2C statistics such as bus error counts and NACK counts, are
implemented in many I2C controllers.
Some drivers already populate the counters in debugfs. Having those
statistics in sysfs can enable for a unified definition across various
I2C drivers, make the statistics more ABI-stable.
Overall the patch works in the following way:
1) A sysfs directory for I2C statistics is created for an i2c_adapter.
2) Each specific I2C driver can optionally instantiate each of the
statistics individually.
Test Process:
1. Clone the OpenBMC repository
2. `devtool modify`and apply patch to the linux-nuvoton recipe
3. Build image for quanta-gsj
4. Build QEMU
5. Run the image-bmc image in QEMU
Results:
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# ls
ber_cnt i2c_speed nack_cnt rec_fail_cnt rec_succ_cnt
timeout_cnt
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# cat *
0
100000
0
0
0
0
Sui Chen (2):
i2c debug counters as sysfs attributes
add npcm7xx debug counters as sysfs attributes
drivers/i2c/busses/i2c-npcm7xx.c | 8 +++
drivers/i2c/i2c-core-base.c | 2 +
drivers/i2c/i2c-dev.c | 98 ++++++++++++++++++++++++++++++++
include/linux/i2c.h | 26 +++++++++
4 files changed, 134 insertions(+)
(Previously sent to linux-i2c, resending to linux-kernel with
CCed correspondents)
CC: OpenBMC Mailing List <openbmc@lists.ozlabs.org>
CC: linux-i2c <linux-i2c@vger.kernel.org>
CC: linux-kernel <linux-kernel@vger.kernel.org>
CC: Joel Stanley <joel@jms.id.au>
CC: Andrew Jeffery <andrew@aj.id.au>
CC: Tali Perry <tali.perry1@gmail.com>
CC: Benjamin Fair <benjaminfair@google.com>
CC: Josh Lehan <krellan@google.com>
--
2.34.0.rc0.344.g81b53c2807-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC Patch Resend 0/2] I2C statistics as sysfs attributes
@ 2021-11-09 22:53 ` Sui Chen
0 siblings, 0 replies; 7+ messages in thread
From: Sui Chen @ 2021-11-09 22:53 UTC (permalink / raw)
To: linux-kernel
Cc: Sui Chen, OpenBMC Mailing List, linux-i2c, Joel Stanley,
Andrew Jeffery, Tali Perry, Benjamin Fair, Josh Lehan
Add I2C statistics such as Bus Error counts and NACK counts as sysfs
attributes.
I2C statistics such as bus error counts and NACK counts, are
implemented in many I2C controllers.
Some drivers already populate the counters in debugfs. Having those
statistics in sysfs can enable for a unified definition across various
I2C drivers, make the statistics more ABI-stable.
Overall the patch works in the following way:
1) A sysfs directory for I2C statistics is created for an i2c_adapter.
2) Each specific I2C driver can optionally instantiate each of the
statistics individually.
Test Process:
1. Clone the OpenBMC repository
2. `devtool modify`and apply patch to the linux-nuvoton recipe
3. Build image for quanta-gsj
4. Build QEMU
5. Run the image-bmc image in QEMU
Results:
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# ls
ber_cnt i2c_speed nack_cnt rec_fail_cnt rec_succ_cnt
timeout_cnt
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# cat *
0
100000
0
0
0
0
Sui Chen (2):
i2c debug counters as sysfs attributes
add npcm7xx debug counters as sysfs attributes
drivers/i2c/busses/i2c-npcm7xx.c | 8 +++
drivers/i2c/i2c-core-base.c | 2 +
drivers/i2c/i2c-dev.c | 98 ++++++++++++++++++++++++++++++++
include/linux/i2c.h | 26 +++++++++
4 files changed, 134 insertions(+)
(Previously sent to linux-i2c, resending to linux-kernel with
CCed correspondents)
CC: OpenBMC Mailing List <openbmc@lists.ozlabs.org>
CC: linux-i2c <linux-i2c@vger.kernel.org>
CC: linux-kernel <linux-kernel@vger.kernel.org>
CC: Joel Stanley <joel@jms.id.au>
CC: Andrew Jeffery <andrew@aj.id.au>
CC: Tali Perry <tali.perry1@gmail.com>
CC: Benjamin Fair <benjaminfair@google.com>
CC: Josh Lehan <krellan@google.com>
--
2.34.0.rc0.344.g81b53c2807-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC Patch Resend 1/2] i2c debug counters as sysfs attributes
2021-11-09 22:53 ` Sui Chen
(?)
@ 2021-11-09 22:53 ` Sui Chen
2021-11-09 23:13 ` Joe Perches
` (2 more replies)
-1 siblings, 3 replies; 7+ messages in thread
From: Sui Chen @ 2021-11-09 22:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Sui Chen
This change adds a few example I2C debug counters as sysfs attributes:
- ber_cnt (bus error count)
- nack_cnt (NACK count)
- rec_fail_cnt, rec_succ_cnt (recovery failure/success count)
- timeout_cnt (timeout count)
- i2c_speed (bus frequency)
The function i2c_adapter_create_stats_folder creates a stats directory
in the device's sysfs directory to hold the debug counters. The platform
drivers will instantiate the counters in the stats directory if
available.
Signed-off-by: Sui Chen <suichen@google.com>
---
drivers/i2c/i2c-core-base.c | 2 +
drivers/i2c/i2c-dev.c | 98 +++++++++++++++++++++++++++++++++++++
include/linux/i2c.h | 26 ++++++++++
3 files changed, 126 insertions(+)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 84f12bf90644a..c42113daf32a7 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1610,6 +1610,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
mutex_unlock(&core_lock);
+ i2c_adapter_create_stats_folder(adap);
+
return 0;
out_reg:
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 77f576e516522..fbec54519bc04 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -767,6 +767,104 @@ static void __exit i2c_dev_exit(void)
unregister_chrdev_region(MKDEV(I2C_MAJOR, 0), I2C_MINORS);
}
+
+static struct i2c_adapter* kobj_to_adapter(struct device* pdev) {
+ struct kobject* dev_kobj = ((struct kobject*)pdev)->parent;
+ struct device* dev = container_of(dev_kobj, struct device, kobj);
+ return to_i2c_adapter(dev);
+}
+
+static ssize_t ber_cnt_show(struct device* pdev,
+ struct device_attribute* attr, char* buf) {
+ u64* ber_cnt = kobj_to_adapter(pdev)->stats->ber_cnt;
+ if (ber_cnt == NULL) return 0;
+ ssize_t ret = sprintf(buf, "%llu\n", *ber_cnt);
+ return ret;
+}
+DEVICE_ATTR_RO(ber_cnt);
+
+ssize_t nack_cnt_show(struct device* pdev,
+ struct device_attribute* attr, char* buf) {
+ u64* nack_cnt = kobj_to_adapter(pdev)->stats->nack_cnt;
+ if (nack_cnt == NULL) return 0;
+ ssize_t ret = sprintf(buf, "%llu\n", *nack_cnt);
+ return ret;
+}
+DEVICE_ATTR_RO(nack_cnt);
+
+ssize_t rec_succ_cnt_show(struct device* pdev,
+ struct device_attribute* attr, char* buf) {
+ u64* rec_succ_cnt = kobj_to_adapter(pdev)->stats->rec_succ_cnt;
+ if (rec_succ_cnt == NULL) return 0;
+ ssize_t ret = sprintf(buf, "%llu\n", *rec_succ_cnt);
+ return ret;
+}
+DEVICE_ATTR_RO(rec_succ_cnt);
+
+ssize_t rec_fail_cnt_show(struct device* pdev,
+ struct device_attribute* attr, char* buf) {
+ u64* rec_fail_cnt = kobj_to_adapter(pdev)->stats->rec_fail_cnt;
+ if (rec_fail_cnt == NULL) return 0;
+ ssize_t ret = sprintf(buf, "%llu\n", *rec_fail_cnt);
+ return ret;
+}
+DEVICE_ATTR_RO(rec_fail_cnt);
+
+ssize_t timeout_cnt_show(struct device* pdev,
+ struct device_attribute* attr, char* buf) {
+ u64* timeout_cnt = kobj_to_adapter(pdev)->stats->timeout_cnt;
+ if (timeout_cnt == NULL) return 0;
+ ssize_t ret = sprintf(buf, "%llu\n", *timeout_cnt);
+ return ret;
+}
+DEVICE_ATTR_RO(timeout_cnt);
+
+ssize_t i2c_speed_show(struct device* pdev,
+ struct device_attribute* attr, char* buf) {
+ u64* i2c_speed = kobj_to_adapter(pdev)->stats->i2c_speed;
+ if (i2c_speed == NULL) return 0;
+ ssize_t ret = sprintf(buf, "%llu\n", *i2c_speed);
+ return ret;
+}
+DEVICE_ATTR_RO(i2c_speed);
+
+void i2c_adapter_create_stats_folder(struct i2c_adapter* adapter) {
+ adapter->stats = kzalloc(sizeof(struct i2c_adapter_stats), GFP_KERNEL);
+ adapter->stats->kobj = kobject_create_and_add("stats", &adapter->dev.kobj);;
+}
+
+void i2c_adapter_stats_register_counter(struct i2c_adapter* adapter,
+ const char* counter_name, void* data_source) {
+ int ret;
+ if (adapter->stats == NULL) {
+ i2c_adapter_create_stats_folder(adapter);
+ }
+
+ if (!strcmp(counter_name, "ber_cnt")) {
+ adapter->stats->ber_cnt = data_source;
+ ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_ber_cnt.attr);
+ } else if (!strcmp(counter_name, "nack_cnt")) {
+ adapter->stats->nack_cnt = data_source;
+ ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_nack_cnt.attr);
+ } else if (!strcmp(counter_name, "rec_succ_cnt")) {
+ adapter->stats->rec_succ_cnt = data_source;
+ ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_rec_succ_cnt.attr);
+ } else if (!strcmp(counter_name, "rec_fail_cnt")) {
+ adapter->stats->rec_fail_cnt = data_source;
+ ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_rec_fail_cnt.attr);
+ } else if (!strcmp(counter_name, "timeout_cnt")) {
+ adapter->stats->timeout_cnt = data_source;
+ ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_timeout_cnt.attr);
+ } else if (!strcmp(counter_name, "i2c_speed")) {
+ adapter->stats->i2c_speed = data_source;
+ ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_i2c_speed.attr);
+ }
+
+ if (ret) {
+ printk("Failed to create sysfs file for %s", counter_name);
+ }
+}
+
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>");
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
MODULE_DESCRIPTION("I2C /dev entries driver");
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 3eb60a2e9e618..b5c84297c60d9 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -21,6 +21,7 @@
#include <linux/of.h> /* for struct device_node */
#include <linux/swab.h> /* for swab16 */
#include <uapi/linux/i2c.h>
+#include <linux/slab.h> /* for kzalloc */
extern struct bus_type i2c_bus_type;
extern struct device_type i2c_adapter_type;
@@ -684,6 +685,26 @@ struct i2c_adapter_quirks {
u16 max_comb_2nd_msg_len;
};
+/**
+ * I2C statistics
+ * The list of statistics are currently copied from npcm7xx.
+ * Perhaps a more universal set of statistics can be used.
+ *
+ * The stats are currently modeled as pointers to members in the bus drivers.
+ * A null pointer indicates the counter is not supported by the bus driver.
+ */
+struct i2c_adapter_stats {
+ struct kobject* kobj;
+
+ // For the counters a NULL value means the counter is not available.
+ u64* ber_cnt;
+ u64* nack_cnt;
+ u64* rec_succ_cnt;
+ u64* rec_fail_cnt;
+ u64* timeout_cnt;
+ u64* i2c_speed;
+};
+
/* enforce max_num_msgs = 2 and use max_comb_*_len for length checks */
#define I2C_AQ_COMB BIT(0)
/* first combined message must be write */
@@ -735,12 +756,17 @@ struct i2c_adapter {
struct i2c_bus_recovery_info *bus_recovery_info;
const struct i2c_adapter_quirks *quirks;
+ struct i2c_adapter_stats* stats;
struct irq_domain *host_notify_domain;
struct regulator *bus_regulator;
};
#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
+void i2c_adapter_create_stats_folder(struct i2c_adapter* adapter);
+void i2c_adapter_stats_register_counter(struct i2c_adapter* adapter,
+ const char* counter_name, void* data_source);
+
static inline void *i2c_get_adapdata(const struct i2c_adapter *adap)
{
return dev_get_drvdata(&adap->dev);
--
2.34.0.rc0.344.g81b53c2807-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC Patch Resend 2/2] add npcm7xx debug counters as sysfs attributes
2021-11-09 22:53 ` Sui Chen
(?)
(?)
@ 2021-11-09 22:53 ` Sui Chen
-1 siblings, 0 replies; 7+ messages in thread
From: Sui Chen @ 2021-11-09 22:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Sui Chen, Tali Perry
This change adds npcm7xx debug counters as sysfs attributes using the
i2c_adapter_stats_register_counter function.
Signed-off-by: Sui Chen <suichen@google.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 2ad166355ec9b..def044207cae2 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2224,6 +2224,14 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
debugfs_create_u64("rec_fail_cnt", 0444, d, &bus->rec_fail_cnt);
debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt);
+ /* register debug counters in sysfs */
+ i2c_adapter_stats_register_counter(&bus->adap, "ber_cnt", &bus->ber_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "nack_cnt", &bus->nack_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "rec_succ_cnt", &bus->rec_succ_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "rec_fail_cnt", &bus->rec_fail_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "timeout_cnt", &bus->timeout_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "i2c_speed", &bus->bus_freq);
+
bus->debugfs = d;
}
--
2.34.0.rc0.344.g81b53c2807-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RFC Patch Resend 1/2] i2c debug counters as sysfs attributes
2021-11-09 22:53 ` [RFC Patch Resend 1/2] i2c debug counters " Sui Chen
@ 2021-11-09 23:13 ` Joe Perches
2021-11-11 9:39 ` kernel test robot
2021-11-11 9:39 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: Joe Perches @ 2021-11-09 23:13 UTC (permalink / raw)
To: Sui Chen, linux-kernel
On Tue, 2021-11-09 at 14:53 -0800, Sui Chen wrote:
> This change adds a few example I2C debug counters as sysfs attributes:
> - ber_cnt (bus error count)
> - nack_cnt (NACK count)
> - rec_fail_cnt, rec_succ_cnt (recovery failure/success count)
> - timeout_cnt (timeout count)
> - i2c_speed (bus frequency)
>
> The function i2c_adapter_create_stats_folder creates a stats directory
> in the device's sysfs directory to hold the debug counters. The platform
> drivers will instantiate the counters in the stats directory if
> available.
[]
> diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
[]
> +static ssize_t ber_cnt_show(struct device* pdev,
> + struct device_attribute* attr, char* buf) {
> + u64* ber_cnt = kobj_to_adapter(pdev)->stats->ber_cnt;
> + if (ber_cnt == NULL) return 0;
> + ssize_t ret = sprintf(buf, "%llu\n", *ber_cnt);
Please do not declare after code.
And this should instead use:
return sysfs_emit(buf, "%llu\n", *ber_cnt);
> + return ret;
> +}
> +DEVICE_ATTR_RO(ber_cnt);
> +
> +ssize_t nack_cnt_show(struct device* pdev,
> + struct device_attribute* attr, char* buf) {
> + u64* nack_cnt = kobj_to_adapter(pdev)->stats->nack_cnt;
> + if (nack_cnt == NULL) return 0;
> + ssize_t ret = sprintf(buf, "%llu\n", *nack_cnt);
etc...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC Patch Resend 1/2] i2c debug counters as sysfs attributes
2021-11-09 22:53 ` [RFC Patch Resend 1/2] i2c debug counters " Sui Chen
2021-11-09 23:13 ` Joe Perches
@ 2021-11-11 9:39 ` kernel test robot
2021-11-11 9:39 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-11-11 9:39 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]
Hi Sui,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on v5.15 next-20211111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sui-Chen/I2C-statistics-as-sysfs-attributes/20211110-065938
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/769ea06c7d8b5744deba5e6cfe2df6d9079b41df
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sui-Chen/I2C-statistics-as-sysfs-attributes/20211110-065938
git checkout 769ea06c7d8b5744deba5e6cfe2df6d9079b41df
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
hppa-linux-ld: drivers/i2c/i2c-core-base.o: in function `i2c_register_adapter':
>> (.text+0x3258): undefined reference to `i2c_adapter_create_stats_folder'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 18748 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC Patch Resend 1/2] i2c debug counters as sysfs attributes
2021-11-09 22:53 ` [RFC Patch Resend 1/2] i2c debug counters " Sui Chen
2021-11-09 23:13 ` Joe Perches
2021-11-11 9:39 ` kernel test robot
@ 2021-11-11 9:39 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-11-11 9:39 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6739 bytes --]
Hi Sui,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on linux/master linus/master v5.15 next-20211111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sui-Chen/I2C-statistics-as-sysfs-attributes/20211110-065938
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: openrisc-buildonly-randconfig-r003-20211111 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/769ea06c7d8b5744deba5e6cfe2df6d9079b41df
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sui-Chen/I2C-statistics-as-sysfs-attributes/20211110-065938
git checkout 769ea06c7d8b5744deba5e6cfe2df6d9079b41df
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/i2c/i2c-dev.c: In function 'ber_cnt_show':
>> drivers/i2c/i2c-dev.c:779:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
779 | ssize_t ret = sprintf(buf, "%llu\n", *ber_cnt);
| ^~~~~~~
drivers/i2c/i2c-dev.c: At top level:
>> drivers/i2c/i2c-dev.c:784:9: error: no previous prototype for 'nack_cnt_show' [-Werror=missing-prototypes]
784 | ssize_t nack_cnt_show(struct device* pdev,
| ^~~~~~~~~~~~~
drivers/i2c/i2c-dev.c: In function 'nack_cnt_show':
drivers/i2c/i2c-dev.c:788:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
788 | ssize_t ret = sprintf(buf, "%llu\n", *nack_cnt);
| ^~~~~~~
drivers/i2c/i2c-dev.c: At top level:
>> drivers/i2c/i2c-dev.c:793:9: error: no previous prototype for 'rec_succ_cnt_show' [-Werror=missing-prototypes]
793 | ssize_t rec_succ_cnt_show(struct device* pdev,
| ^~~~~~~~~~~~~~~~~
drivers/i2c/i2c-dev.c: In function 'rec_succ_cnt_show':
drivers/i2c/i2c-dev.c:797:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
797 | ssize_t ret = sprintf(buf, "%llu\n", *rec_succ_cnt);
| ^~~~~~~
drivers/i2c/i2c-dev.c: At top level:
>> drivers/i2c/i2c-dev.c:802:9: error: no previous prototype for 'rec_fail_cnt_show' [-Werror=missing-prototypes]
802 | ssize_t rec_fail_cnt_show(struct device* pdev,
| ^~~~~~~~~~~~~~~~~
drivers/i2c/i2c-dev.c: In function 'rec_fail_cnt_show':
drivers/i2c/i2c-dev.c:806:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
806 | ssize_t ret = sprintf(buf, "%llu\n", *rec_fail_cnt);
| ^~~~~~~
drivers/i2c/i2c-dev.c: At top level:
>> drivers/i2c/i2c-dev.c:811:9: error: no previous prototype for 'timeout_cnt_show' [-Werror=missing-prototypes]
811 | ssize_t timeout_cnt_show(struct device* pdev,
| ^~~~~~~~~~~~~~~~
drivers/i2c/i2c-dev.c: In function 'timeout_cnt_show':
drivers/i2c/i2c-dev.c:815:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
815 | ssize_t ret = sprintf(buf, "%llu\n", *timeout_cnt);
| ^~~~~~~
drivers/i2c/i2c-dev.c: At top level:
>> drivers/i2c/i2c-dev.c:820:9: error: no previous prototype for 'i2c_speed_show' [-Werror=missing-prototypes]
820 | ssize_t i2c_speed_show(struct device* pdev,
| ^~~~~~~~~~~~~~
drivers/i2c/i2c-dev.c: In function 'i2c_speed_show':
drivers/i2c/i2c-dev.c:824:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
824 | ssize_t ret = sprintf(buf, "%llu\n", *i2c_speed);
| ^~~~~~~
cc1: all warnings being treated as errors
vim +779 drivers/i2c/i2c-dev.c
774
775 static ssize_t ber_cnt_show(struct device* pdev,
776 struct device_attribute* attr, char* buf) {
777 u64* ber_cnt = kobj_to_adapter(pdev)->stats->ber_cnt;
778 if (ber_cnt == NULL) return 0;
> 779 ssize_t ret = sprintf(buf, "%llu\n", *ber_cnt);
780 return ret;
781 }
782 DEVICE_ATTR_RO(ber_cnt);
783
> 784 ssize_t nack_cnt_show(struct device* pdev,
785 struct device_attribute* attr, char* buf) {
786 u64* nack_cnt = kobj_to_adapter(pdev)->stats->nack_cnt;
787 if (nack_cnt == NULL) return 0;
788 ssize_t ret = sprintf(buf, "%llu\n", *nack_cnt);
789 return ret;
790 }
791 DEVICE_ATTR_RO(nack_cnt);
792
> 793 ssize_t rec_succ_cnt_show(struct device* pdev,
794 struct device_attribute* attr, char* buf) {
795 u64* rec_succ_cnt = kobj_to_adapter(pdev)->stats->rec_succ_cnt;
796 if (rec_succ_cnt == NULL) return 0;
797 ssize_t ret = sprintf(buf, "%llu\n", *rec_succ_cnt);
798 return ret;
799 }
800 DEVICE_ATTR_RO(rec_succ_cnt);
801
> 802 ssize_t rec_fail_cnt_show(struct device* pdev,
803 struct device_attribute* attr, char* buf) {
804 u64* rec_fail_cnt = kobj_to_adapter(pdev)->stats->rec_fail_cnt;
805 if (rec_fail_cnt == NULL) return 0;
806 ssize_t ret = sprintf(buf, "%llu\n", *rec_fail_cnt);
807 return ret;
808 }
809 DEVICE_ATTR_RO(rec_fail_cnt);
810
> 811 ssize_t timeout_cnt_show(struct device* pdev,
812 struct device_attribute* attr, char* buf) {
813 u64* timeout_cnt = kobj_to_adapter(pdev)->stats->timeout_cnt;
814 if (timeout_cnt == NULL) return 0;
815 ssize_t ret = sprintf(buf, "%llu\n", *timeout_cnt);
816 return ret;
817 }
818 DEVICE_ATTR_RO(timeout_cnt);
819
> 820 ssize_t i2c_speed_show(struct device* pdev,
821 struct device_attribute* attr, char* buf) {
822 u64* i2c_speed = kobj_to_adapter(pdev)->stats->i2c_speed;
823 if (i2c_speed == NULL) return 0;
824 ssize_t ret = sprintf(buf, "%llu\n", *i2c_speed);
825 return ret;
826 }
827 DEVICE_ATTR_RO(i2c_speed);
828
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 22999 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-11 9:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 22:53 [RFC Patch Resend 0/2] I2C statistics as sysfs attributes Sui Chen
2021-11-09 22:53 ` Sui Chen
2021-11-09 22:53 ` [RFC Patch Resend 1/2] i2c debug counters " Sui Chen
2021-11-09 23:13 ` Joe Perches
2021-11-11 9:39 ` kernel test robot
2021-11-11 9:39 ` kernel test robot
2021-11-09 22:53 ` [RFC Patch Resend 2/2] add npcm7xx " Sui Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.