All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC Patch v2 0/3] I2C statistics as sysfs attributes
@ 2021-12-03  2:37 ` Sui Chen
  0 siblings, 0 replies; 25+ messages in thread
From: Sui Chen @ 2021-12-03  2:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: openbmc, linux-i2c, joel, andrew, tali.perry1, benjaminfair,
	krellan, joe, Sui Chen

Add I2C statistics such as Bus Error counts and NACK counts as sysfs
attributes so they don't need to live in debugfs.

There are a few I2C statistics that are implemented in many I2C
controllers, such as bus error counts and NACK counts. Having those
statistics in sysfs will 1) allow for a unified definition across
various I2C drivers, and 2) make the statistics more ABI-stable and
available on devices with the debugfs disabled.

Overall the patch works as the following way:
1) An I2C statistics sysfs directory is created.
2) Each specific I2C driver is responsible for instantiating the
statistics available.

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      tx_complete_cnt
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# cat *
0
100000
0
0
0
0
53

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      |   2 +
 drivers/i2c/i2c-dev.c            | 103 +++++++++++++++++++++++++++++++
 include/linux/i2c.h              |  27 ++++++++
 4 files changed, 145 insertions(+)

-- 
2.34.0.384.gca35af8252-goog


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [RFC Patch v2 1/3] i2c debug counters as sysfs attributes
  2021-12-03  2:37   ` Sui Chen
@ 2021-12-06 14:03 ` Dan Carpenter
  -1 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-12-05  0:40 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4459 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211203023728.3699610-2-suichen@google.com>
References: <20211203023728.3699610-2-suichen@google.com>
TO: Sui Chen <suichen@google.com>

Hi Sui,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on linux/master linus/master v5.16-rc3 next-20211203]
[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/20211203-103913
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-m001-20211203 (https://download.01.org/0day-ci/archive/20211205/202112050811.jZxEi6SN-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/i2c/i2c-dev.c:866 i2c_adapter_stats_register_counter() error: uninitialized symbol 'ret'.

vim +/ret +866 drivers/i2c/i2c-dev.c

16ccbe6d6d8b9a Sui Chen 2021-12-02  835  
16ccbe6d6d8b9a Sui Chen 2021-12-02  836  void i2c_adapter_stats_register_counter(struct i2c_adapter* adapter,
16ccbe6d6d8b9a Sui Chen 2021-12-02  837  	const char* counter_name, void* data_source) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  838  	int ret;
16ccbe6d6d8b9a Sui Chen 2021-12-02  839  	if (adapter->stats == NULL) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  840  		i2c_adapter_create_stats_folder(adapter);
16ccbe6d6d8b9a Sui Chen 2021-12-02  841  	}
16ccbe6d6d8b9a Sui Chen 2021-12-02  842  
16ccbe6d6d8b9a Sui Chen 2021-12-02  843  	if (!strcmp(counter_name, "ber_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  844  		adapter->stats->ber_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  845  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_ber_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  846  	} else if (!strcmp(counter_name, "nack_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  847  		adapter->stats->nack_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  848  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_nack_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  849  	} else if (!strcmp(counter_name, "rec_succ_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  850  		adapter->stats->rec_succ_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  851  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_rec_succ_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  852  	} else if (!strcmp(counter_name, "rec_fail_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  853  		adapter->stats->rec_fail_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  854  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_rec_fail_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  855  	} else if (!strcmp(counter_name, "timeout_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  856  		adapter->stats->timeout_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  857  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_timeout_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  858  	} else if (!strcmp(counter_name, "i2c_speed")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  859  		adapter->stats->i2c_speed = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  860  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_i2c_speed.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  861  	} else if (!strcmp(counter_name, "tx_complete_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  862  		adapter->stats->tx_complete_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  863  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_tx_complete_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  864  	}
16ccbe6d6d8b9a Sui Chen 2021-12-02  865  
16ccbe6d6d8b9a Sui Chen 2021-12-02 @866  	if (ret) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  867  		printk("Failed to create sysfs file for %s", counter_name);
16ccbe6d6d8b9a Sui Chen 2021-12-02  868  	}
16ccbe6d6d8b9a Sui Chen 2021-12-02  869  }
16ccbe6d6d8b9a Sui Chen 2021-12-02  870  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [RFC Patch v2 1/3] i2c debug counters as sysfs attributes
@ 2021-12-05  1:43 kernel test robot
  0 siblings, 0 replies; 25+ messages in thread
From: kernel test robot @ 2021-12-05  1:43 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 17822 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211203023728.3699610-2-suichen@google.com>
References: <20211203023728.3699610-2-suichen@google.com>
TO: Sui Chen <suichen@google.com>

Hi Sui,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on linux/master linus/master v5.16-rc3 next-20211203]
[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/20211203-103913
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20211203 (https://download.01.org/0day-ci/archive/20211205/202112050932.BQQ8v5Zy-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1e328b06c15273edf4a40a27ca24931b5efb3a87)
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
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/16ccbe6d6d8b9a6e81ba9f40b70d3af92d04776e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sui-Chen/I2C-statistics-as-sysfs-attributes/20211203-103913
        git checkout 16ccbe6d6d8b9a6e81ba9f40b70d3af92d04776e
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   4 warnings generated.
   Suppressed 4 warnings (4 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   24 warnings generated.
   kernel/sched/fair.c:7052:37: warning: Access to field 'vruntime' results in a dereference of a null pointer (loaded from variable 'se') [clang-analyzer-core.NullDereference]
           s64 gran, vdiff = curr->vruntime - se->vruntime;
                                              ^
   kernel/sched/fair.c:7371:9: note: Calling 'pick_next_task_fair'
           return pick_next_task_fair(rq, NULL, NULL);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:7234:7: note: Calling 'sched_fair_runnable'
           if (!sched_fair_runnable(rq))
                ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/sched.h:2221:9: note: Assuming field 'nr_running' is > 0
           return rq->cfs.nr_running > 0;
                  ^~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/sched.h:2221:2: note: Returning without writing to 'rq->cfs.tasks_timeline.rb_leftmost', which participates in a condition later
           return rq->cfs.nr_running > 0;
           ^
   kernel/sched/sched.h:2221:2: note: Returning without writing to 'rq->cfs.next', which participates in a condition later
   kernel/sched/fair.c:7234:7: note: Returning from 'sched_fair_runnable'
           if (!sched_fair_runnable(rq))
                ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:7234:2: note: Taking false branch
           if (!sched_fair_runnable(rq))
           ^
   kernel/sched/fair.c:7315:6: note: 'prev' is null
           if (prev)
               ^~~~
   kernel/sched/fair.c:7315:2: note: Taking false branch
           if (prev)
           ^
   kernel/sched/fair.c:7319:33: note: Passing null pointer value via 2nd parameter 'curr'
                   se = pick_next_entity(cfs_rq, NULL);
                                                 ^
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
   #define NULL ((void *)0)
                ^~~~~~~~~~~
   kernel/sched/fair.c:7319:8: note: Calling 'pick_next_entity'
                   se = pick_next_entity(cfs_rq, NULL);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:4474:30: note: Calling '__pick_first_entity'
           struct sched_entity *left = __pick_first_entity(cfs_rq);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:600:6: note: Assuming 'left' is null
           if (!left)
               ^~~~~
   kernel/sched/fair.c:600:2: note: Taking true branch
           if (!left)
           ^
   kernel/sched/fair.c:601:3: note: Returning without writing to 'cfs_rq->next', which participates in a condition later
                   return NULL;
                   ^
   kernel/sched/fair.c:601:3: note: Returning null pointer, which participates in a condition later
                   return NULL;
                   ^~~~~~~~~~~
   kernel/sched/fair.c:4474:30: note: Returning from '__pick_first_entity'
           struct sched_entity *left = __pick_first_entity(cfs_rq);
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:4481:7: note: 'left' is null
           if (!left || (curr && entity_before(curr, left)))
                ^~~~
   kernel/sched/fair.c:4481:12: note: Left side of '||' is true
           if (!left || (curr && entity_before(curr, left)))
                     ^
   kernel/sched/fair.c:4482:3: note: Null pointer value stored to 'left'
                   left = curr;
                   ^~~~~~~~~~~
   kernel/sched/fair.c:4490:6: note: Assuming field 'skip' is null
           if (cfs_rq->skip && cfs_rq->skip == se) {
               ^~~~~~~~~~~~
   kernel/sched/fair.c:4490:19: note: Left side of '&&' is false
           if (cfs_rq->skip && cfs_rq->skip == se) {
                            ^
   kernel/sched/fair.c:4505:6: note: Assuming field 'next' is non-null
           if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
               ^~~~~~~~~~~~
   kernel/sched/fair.c:4505:6: note: Left side of '&&' is true
   kernel/sched/fair.c:4505:58: note: Passing null pointer value via 2nd parameter 'se'
           if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
                                                                   ^~~~
   kernel/sched/fair.c:4505:22: note: Calling 'wakeup_preempt_entity'
           if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/sched/fair.c:7052:37: note: Access to field 'vruntime' results in a dereference of a null pointer (loaded from variable 'se')
           s64 gran, vdiff = curr->vruntime - se->vruntime;
                                              ^~
   Suppressed 23 warnings (4 in non-user code, 19 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   10 warnings generated.
>> drivers/i2c/i2c-dev.c:866:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (ret) {
               ^~~
   drivers/i2c/i2c-dev.c:838:2: note: 'ret' declared without an initial value
           int ret;
           ^~~~~~~
   drivers/i2c/i2c-dev.c:839:6: note: Assuming field 'stats' is not equal to NULL
           if (adapter->stats == NULL) {
               ^~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:839:2: note: Taking false branch
           if (adapter->stats == NULL) {
           ^
   drivers/i2c/i2c-dev.c:843:6: note: Assuming the condition is false
           if (!strcmp(counter_name, "ber_cnt")) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:843:2: note: Taking false branch
           if (!strcmp(counter_name, "ber_cnt")) {
           ^
   drivers/i2c/i2c-dev.c:846:13: note: Assuming the condition is false
           } else if (!strcmp(counter_name, "nack_cnt")) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:846:9: note: Taking false branch
           } else if (!strcmp(counter_name, "nack_cnt")) {
                  ^
   drivers/i2c/i2c-dev.c:849:13: note: Assuming the condition is false
           } else if (!strcmp(counter_name, "rec_succ_cnt")) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:849:9: note: Taking false branch
           } else if (!strcmp(counter_name, "rec_succ_cnt")) {
                  ^
   drivers/i2c/i2c-dev.c:852:13: note: Assuming the condition is false
           } else if (!strcmp(counter_name, "rec_fail_cnt")) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:852:9: note: Taking false branch
           } else if (!strcmp(counter_name, "rec_fail_cnt")) {
                  ^
   drivers/i2c/i2c-dev.c:855:13: note: Assuming the condition is false
           } else if (!strcmp(counter_name, "timeout_cnt")) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:855:9: note: Taking false branch
           } else if (!strcmp(counter_name, "timeout_cnt")) {
                  ^
   drivers/i2c/i2c-dev.c:858:13: note: Assuming the condition is false
           } else if (!strcmp(counter_name, "i2c_speed")) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:858:9: note: Taking false branch
           } else if (!strcmp(counter_name, "i2c_speed")) {
                  ^
   drivers/i2c/i2c-dev.c:861:13: note: Assuming the condition is false
           } else if (!strcmp(counter_name, "tx_complete_cnt")) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/i2c/i2c-dev.c:861:9: note: Taking false branch
           } else if (!strcmp(counter_name, "tx_complete_cnt")) {
                  ^
   drivers/i2c/i2c-dev.c:866:6: note: Branch condition evaluates to a garbage value
           if (ret) {
               ^~~
   Suppressed 9 warnings (2 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   14 warnings generated.
   drivers/media/dvb-frontends/rtl2832.c:145:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:145:21: note: Value stored to 'client' during its initialization is never read
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:175:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:175:21: note: Value stored to 'client' during its initialization is never read
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:214:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:214:21: note: Value stored to 'client' during its initialization is never read
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:248:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:248:21: note: Value stored to 'client' during its initialization is never read
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:372:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:372:21: note: Value stored to 'client' during its initialization is never read
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:394:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:394:21: note: Value stored to 'client' during its initialization is never read
           struct i2c_client *client = dev->client;
                              ^~~~~~   ~~~~~~~~~~~
   drivers/media/dvb-frontends/rtl2832.c:528:21: warning: Value stored to 'client' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct i2c_client *client = dev->client;

vim +866 drivers/i2c/i2c-dev.c

16ccbe6d6d8b9a Sui Chen 2021-12-02  835  
16ccbe6d6d8b9a Sui Chen 2021-12-02  836  void i2c_adapter_stats_register_counter(struct i2c_adapter* adapter,
16ccbe6d6d8b9a Sui Chen 2021-12-02  837  	const char* counter_name, void* data_source) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  838  	int ret;
16ccbe6d6d8b9a Sui Chen 2021-12-02  839  	if (adapter->stats == NULL) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  840  		i2c_adapter_create_stats_folder(adapter);
16ccbe6d6d8b9a Sui Chen 2021-12-02  841  	}
16ccbe6d6d8b9a Sui Chen 2021-12-02  842  
16ccbe6d6d8b9a Sui Chen 2021-12-02  843  	if (!strcmp(counter_name, "ber_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  844  		adapter->stats->ber_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  845  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_ber_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  846  	} else if (!strcmp(counter_name, "nack_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  847  		adapter->stats->nack_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  848  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_nack_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  849  	} else if (!strcmp(counter_name, "rec_succ_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  850  		adapter->stats->rec_succ_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  851  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_rec_succ_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  852  	} else if (!strcmp(counter_name, "rec_fail_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  853  		adapter->stats->rec_fail_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  854  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_rec_fail_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  855  	} else if (!strcmp(counter_name, "timeout_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  856  		adapter->stats->timeout_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  857  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_timeout_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  858  	} else if (!strcmp(counter_name, "i2c_speed")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  859  		adapter->stats->i2c_speed = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  860  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_i2c_speed.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  861  	} else if (!strcmp(counter_name, "tx_complete_cnt")) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  862  		adapter->stats->tx_complete_cnt = data_source;
16ccbe6d6d8b9a Sui Chen 2021-12-02  863  		ret = sysfs_create_file(adapter->stats->kobj, &dev_attr_tx_complete_cnt.attr);
16ccbe6d6d8b9a Sui Chen 2021-12-02  864  	}
16ccbe6d6d8b9a Sui Chen 2021-12-02  865  
16ccbe6d6d8b9a Sui Chen 2021-12-02 @866  	if (ret) {
16ccbe6d6d8b9a Sui Chen 2021-12-02  867  		printk("Failed to create sysfs file for %s", counter_name);
16ccbe6d6d8b9a Sui Chen 2021-12-02  868  	}
16ccbe6d6d8b9a Sui Chen 2021-12-02  869  }
16ccbe6d6d8b9a Sui Chen 2021-12-02  870  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2022-01-03  9:45 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03  2:37 [RFC Patch v2 0/3] I2C statistics as sysfs attributes Sui Chen
2021-12-03  2:37 ` Sui Chen
2021-12-03  2:37 ` [RFC Patch v2 1/3] i2c debug counters " Sui Chen
2021-12-03  2:37   ` Sui Chen
2021-12-03  2:50   ` Joe Perches
2021-12-03  2:50     ` Joe Perches
2021-12-03  5:35     ` Sui Chen
2021-12-03  5:35       ` Sui Chen
2021-12-03  5:54   ` Joe Perches
2021-12-03  5:54     ` Joe Perches
2021-12-03 12:36   ` kernel test robot
2021-12-03 14:18   ` kernel test robot
2021-12-03  2:37 ` [RFC Patch v2 2/3] i2c: npcm7xx: add tx_complete counter Sui Chen
2021-12-03  2:37   ` Sui Chen
2021-12-03  2:37 ` [RFC Patch v2 3/3] add npcm7xx debug counters as sysfs attributes Sui Chen
2021-12-03  2:37   ` Sui Chen
2021-12-03 21:15   ` kernel test robot
2021-12-03 16:37 ` [RFC Patch v2 0/3] I2C statistics " Wolfram Sang
2021-12-03 16:37   ` Wolfram Sang
2021-12-07 16:00   ` Sui Chen
2022-01-03  9:44     ` Wolfram Sang
2022-01-03  9:44       ` Wolfram Sang
2021-12-05  0:40 [RFC Patch v2 1/3] i2c debug counters " kernel test robot
2021-12-06 14:03 ` Dan Carpenter
2021-12-05  1:43 kernel test robot

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.