All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v7 0/5] Introduce the Counter character device interface
@ 2020-12-26  0:15 ` William Breathitt Gray
  0 siblings, 0 replies; 51+ messages in thread
From: William Breathitt Gray @ 2020-12-26  0:15 UTC (permalink / raw)
  To: jic23
  Cc: kernel, linux-stm32, a.fatoum, kamel.bouhara, gwendal,
	alexandre.belloni, david, linux-iio, linux-kernel,
	linux-arm-kernel, syednwaris, patrick.havelange, fabrice.gasnier,
	mcoquelin.stm32, alexandre.torgue, William Breathitt Gray

Changes in v7:
 - Implemented u32 enums; enum types can now be used directly for
   callbacks and values
 - Fixed refcount underflow bug
 - Refactored all err check to check for err < 0; this should help
   prevent future oversights on valid positive return valids
 - Use mutex instead of raw_spin_lock in counter_chrdev_read();
   kifo_to_user() can now safely sleep
 - Renamed COUNTER_COMPONENT_DUMMY to COUNTER_COMPONENT_NONE to make
   purpose more obvious
 - Introduced a watch_validate() callback
 - Consolidated the functionality to clear the watches to the
   counter_clear_watches() function
 - Reimplemented counter_push_event() as a void function; on error,
   errno is returned via struct counter_event so that it can be handled
   by userspace (because interrupt handlers can't do much for this)
 - Renamed the events_config() callback to events_configure();
   "events_config" could be confused as a read callback when this is
   actually intended to configure the device for the requested events
 - Reimplemented 104-QUAD-8 driver to use events_configure() and
   watch_validate() callbacks; irq_trigger_enable sysfs attribute
   removed because events_configure() now serves this purpose

The changes for this revision were much simpler compared to the previous
revisions. I don't have any further questions for this patchset, so it's
really just a search for possible bugs or regressions now. Please test
and verify this patchset on your systems, and ACK appropriately.

To summarize the main points: there are no changes to the existing
Counter sysfs userspace interface; a Counter character device interface
is introduced that allows Counter events and associated data to be
read() by userspace; the events_configure() and watch_validate() driver
callbacks are introduced to support Counter events; and IRQ support is
added to the 104-QUAD-8 driver, serving as an example of how to support
the new Counter events functionality.

William Breathitt Gray (5):
  counter: Internalize sysfs interface code
  docs: counter: Update to reflect sysfs internalization
  counter: Add character device interface
  docs: counter: Document character device interface
  counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8

 Documentation/ABI/testing/sysfs-bus-counter   |   18 +-
 .../ABI/testing/sysfs-bus-counter-104-quad-8  |   25 +
 Documentation/driver-api/generic-counter.rst  |  416 ++++-
 .../userspace-api/ioctl/ioctl-number.rst      |    1 +
 MAINTAINERS                                   |    2 +-
 drivers/counter/104-quad-8.c                  |  799 +++++----
 drivers/counter/Kconfig                       |    6 +-
 drivers/counter/Makefile                      |    1 +
 drivers/counter/counter-chrdev.c              |  490 ++++++
 drivers/counter/counter-chrdev.h              |   16 +
 drivers/counter/counter-core.c                |  182 ++
 drivers/counter/counter-sysfs.c               |  868 ++++++++++
 drivers/counter/counter-sysfs.h               |   13 +
 drivers/counter/counter.c                     | 1496 -----------------
 drivers/counter/ftm-quaddec.c                 |   61 +-
 drivers/counter/microchip-tcb-capture.c       |  103 +-
 drivers/counter/stm32-lptimer-cnt.c           |  181 +-
 drivers/counter/stm32-timer-cnt.c             |  149 +-
 drivers/counter/ti-eqep.c                     |  224 +--
 include/linux/counter.h                       |  716 ++++----
 include/linux/counter_enum.h                  |   45 -
 include/uapi/linux/counter.h                  |  123 ++
 22 files changed, 3259 insertions(+), 2676 deletions(-)
 create mode 100644 drivers/counter/counter-chrdev.c
 create mode 100644 drivers/counter/counter-chrdev.h
 create mode 100644 drivers/counter/counter-core.c
 create mode 100644 drivers/counter/counter-sysfs.c
 create mode 100644 drivers/counter/counter-sysfs.h
 delete mode 100644 drivers/counter/counter.c
 delete mode 100644 include/linux/counter_enum.h
 create mode 100644 include/uapi/linux/counter.h

-- 
2.29.2


^ permalink raw reply	[flat|nested] 51+ messages in thread
* Re: [PATCH v7 1/5] counter: Internalize sysfs interface code
@ 2020-12-26 18:47 kernel test robot
  0 siblings, 0 replies; 51+ messages in thread
From: kernel test robot @ 2020-12-26 18:47 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <fc40ab7f4a38e80d86715daa5eaf744dd645a75b.1608935587.git.vilhelm.gray@gmail.com>
References: <fc40ab7f4a38e80d86715daa5eaf744dd645a75b.1608935587.git.vilhelm.gray@gmail.com>
TO: William Breathitt Gray <vilhelm.gray@gmail.com>

Hi William,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on next-20201223]
[cannot apply to stm32/stm32-next linux/master v5.10]
[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/William-Breathitt-Gray/Introduce-the-Counter-character-device-interface/20201226-082226
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 61d791365b72a89062fbbea69aa61479476da946
:::::: branch date: 18 hours ago
:::::: commit date: 18 hours ago
config: i386-randconfig-m021-20201226 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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>

New smatch warnings:
drivers/counter/counter-sysfs.c:172 counter_comp_u32_show() error: uninitialized symbol 'err'.

Old smatch warnings:
drivers/counter/counter-sysfs.c:104 counter_comp_u8_show() error: uninitialized symbol 'err'.
drivers/counter/counter-sysfs.c:289 counter_comp_u64_show() error: uninitialized symbol 'err'.

vim +/err +172 drivers/counter/counter-sysfs.c

d2735d30323ad0d William Breathitt Gray 2020-12-25  147  
d2735d30323ad0d William Breathitt Gray 2020-12-25  148  static ssize_t counter_comp_u32_show(struct device *dev,
d2735d30323ad0d William Breathitt Gray 2020-12-25  149  				     struct device_attribute *attr, char *buf)
d2735d30323ad0d William Breathitt Gray 2020-12-25  150  {
d2735d30323ad0d William Breathitt Gray 2020-12-25  151  	const struct counter_attribute *const a = to_counter_attribute(attr);
d2735d30323ad0d William Breathitt Gray 2020-12-25  152  	struct counter_device *const counter = dev_get_drvdata(dev);
d2735d30323ad0d William Breathitt Gray 2020-12-25  153  	const struct counter_available *const avail = a->comp.priv;
d2735d30323ad0d William Breathitt Gray 2020-12-25  154  	int err;
d2735d30323ad0d William Breathitt Gray 2020-12-25  155  	u32 data = 0;
d2735d30323ad0d William Breathitt Gray 2020-12-25  156  
d2735d30323ad0d William Breathitt Gray 2020-12-25  157  	switch (a->scope) {
d2735d30323ad0d William Breathitt Gray 2020-12-25  158  	case COUNTER_SCOPE_DEVICE:
d2735d30323ad0d William Breathitt Gray 2020-12-25  159  		err = a->comp.device_u32_read(counter, &data);
d2735d30323ad0d William Breathitt Gray 2020-12-25  160  		break;
d2735d30323ad0d William Breathitt Gray 2020-12-25  161  	case COUNTER_SCOPE_SIGNAL:
d2735d30323ad0d William Breathitt Gray 2020-12-25  162  		err = a->comp.signal_u32_read(counter, a->parent, &data);
d2735d30323ad0d William Breathitt Gray 2020-12-25  163  		break;
d2735d30323ad0d William Breathitt Gray 2020-12-25  164  	case COUNTER_SCOPE_COUNT:
d2735d30323ad0d William Breathitt Gray 2020-12-25  165  		if (a->comp.type == COUNTER_COMP_SYNAPSE_ACTION)
d2735d30323ad0d William Breathitt Gray 2020-12-25  166  			err = a->comp.action_read(counter, a->parent,
d2735d30323ad0d William Breathitt Gray 2020-12-25  167  						  a->comp.priv, &data);
d2735d30323ad0d William Breathitt Gray 2020-12-25  168  		else
d2735d30323ad0d William Breathitt Gray 2020-12-25  169  			err = a->comp.count_u32_read(counter, a->parent, &data);
d2735d30323ad0d William Breathitt Gray 2020-12-25  170  		break;
d2735d30323ad0d William Breathitt Gray 2020-12-25  171  	}
d2735d30323ad0d William Breathitt Gray 2020-12-25 @172  	if (err < 0)
d2735d30323ad0d William Breathitt Gray 2020-12-25  173  		return err;
d2735d30323ad0d William Breathitt Gray 2020-12-25  174  
d2735d30323ad0d William Breathitt Gray 2020-12-25  175  	switch (a->comp.type) {
d2735d30323ad0d William Breathitt Gray 2020-12-25  176  	case COUNTER_COMP_FUNCTION:
d2735d30323ad0d William Breathitt Gray 2020-12-25  177  		return sprintf(buf, "%s\n", counter_function_str[data]);
d2735d30323ad0d William Breathitt Gray 2020-12-25  178  	case COUNTER_COMP_SIGNAL_LEVEL:
d2735d30323ad0d William Breathitt Gray 2020-12-25  179  		return sprintf(buf, "%s\n", counter_signal_value_str[data]);
d2735d30323ad0d William Breathitt Gray 2020-12-25  180  	case COUNTER_COMP_SYNAPSE_ACTION:
d2735d30323ad0d William Breathitt Gray 2020-12-25  181  		return sprintf(buf, "%s\n", counter_synapse_action_str[data]);
d2735d30323ad0d William Breathitt Gray 2020-12-25  182  	case COUNTER_COMP_ENUM:
d2735d30323ad0d William Breathitt Gray 2020-12-25  183  		return sprintf(buf, "%s\n", avail->strs[data]);
d2735d30323ad0d William Breathitt Gray 2020-12-25  184  	case COUNTER_COMP_COUNT_DIRECTION:
d2735d30323ad0d William Breathitt Gray 2020-12-25  185  		return sprintf(buf, "%s\n", counter_count_direction_str[data]);
d2735d30323ad0d William Breathitt Gray 2020-12-25  186  	case COUNTER_COMP_COUNT_MODE:
d2735d30323ad0d William Breathitt Gray 2020-12-25  187  		return sprintf(buf, "%s\n", counter_count_mode_str[data]);
d2735d30323ad0d William Breathitt Gray 2020-12-25  188  	default:
d2735d30323ad0d William Breathitt Gray 2020-12-25  189  		break;
d2735d30323ad0d William Breathitt Gray 2020-12-25  190  	}
d2735d30323ad0d William Breathitt Gray 2020-12-25  191  
d2735d30323ad0d William Breathitt Gray 2020-12-25  192  	return sprintf(buf, "%u\n", (unsigned int)data);
d2735d30323ad0d William Breathitt Gray 2020-12-25  193  }
d2735d30323ad0d William Breathitt Gray 2020-12-25  194  

---
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: 37701 bytes --]

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

end of thread, other threads:[~2021-02-12  6:34 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-26  0:15 [PATCH v7 0/5] Introduce the Counter character device interface William Breathitt Gray
2020-12-26  0:15 ` William Breathitt Gray
2020-12-26  0:15 ` [PATCH v7 1/5] counter: Internalize sysfs interface code William Breathitt Gray
2020-12-30 14:37   ` Jonathan Cameron
2021-01-06  5:29     ` William Breathitt Gray
2021-01-06  5:29       ` William Breathitt Gray
2020-12-30 23:24   ` David Lechner
2020-12-30 23:24     ` David Lechner
2021-01-06  5:30     ` William Breathitt Gray
2021-01-06  5:30       ` William Breathitt Gray
2020-12-26  0:15 ` [PATCH v7 2/5] docs: counter: Update to reflect sysfs internalization William Breathitt Gray
2020-12-26  0:15   ` William Breathitt Gray
2020-12-30 14:41   ` Jonathan Cameron
2020-12-30 14:41     ` Jonathan Cameron
2020-12-26  0:15 ` [PATCH v7 3/5] counter: Add character device interface William Breathitt Gray
2020-12-26  0:15   ` William Breathitt Gray
2020-12-30 15:04   ` Jonathan Cameron
2020-12-30 15:04     ` Jonathan Cameron
2021-02-12  6:32     ` William Breathitt Gray
2021-02-12  6:32       ` William Breathitt Gray
2020-12-30 21:36   ` David Lechner
2020-12-30 21:36     ` David Lechner
2021-01-30  4:59     ` William Breathitt Gray
2021-01-30  4:59       ` William Breathitt Gray
2021-01-04 18:15   ` Dan Carpenter
2021-01-04 18:15     ` Dan Carpenter
2021-01-28  9:01   ` Oleksij Rempel
2021-01-28  9:01     ` Oleksij Rempel
2021-01-30  5:15     ` William Breathitt Gray
2021-01-30  5:15       ` William Breathitt Gray
2020-12-26  0:15 ` [PATCH v7 4/5] docs: counter: Document " William Breathitt Gray
2020-12-26  0:15   ` William Breathitt Gray
2020-12-30 14:47   ` Jonathan Cameron
2020-12-30 14:47     ` Jonathan Cameron
2020-12-30 18:18   ` David Lechner
2020-12-30 18:18     ` David Lechner
2020-12-26  0:15 ` [PATCH v7 5/5] counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8 William Breathitt Gray
2020-12-26  0:15   ` William Breathitt Gray
2020-12-30 15:31   ` Jonathan Cameron
2020-12-30 15:31     ` Jonathan Cameron
2021-02-12  6:04     ` William Breathitt Gray
2021-02-12  6:04       ` William Breathitt Gray
2020-12-30 17:36   ` David Lechner
2020-12-30 17:36     ` David Lechner
2021-02-11 23:56     ` William Breathitt Gray
2021-02-11 23:56       ` William Breathitt Gray
2021-02-12  1:10       ` David Lechner
2021-02-12  1:10         ` David Lechner
2020-12-30 23:34 ` [PATCH v7 0/5] Introduce the Counter character device interface David Lechner
2020-12-30 23:34   ` David Lechner
2020-12-26 18:47 [PATCH v7 1/5] counter: Internalize sysfs interface code 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.