Skip to content

Introduce the Counter character device interface

William Breathitt Gray linux-arm-kernel linux-iio lkml 17 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v17 Latest9 patches 6 repliesIn review
  2. v1614 patches 20 repliesApplied
  3. v1513 patches 7 repliesApplied
Earlier versions · 14
VersionPostedPatchesRepliesStatus
v1417 patches8 repliesApplied
v1317 patches2 repliesSuperseded
v1217 patches32 repliesSuperseded
v1133 patches30 repliesApplied
v1033 patches21 repliesSuperseded
v933 patches6 repliesSuperseded
v822 patches47 repliesSuperseded
v75 patches20 repliesSuperseded
v65 patches13 repliesSuperseded
v55 patches30 repliesSuperseded
v45 patches17 repliesSuperseded
v34 patches5 repliesSuperseded
v24 patches12 repliesSuperseded
v14 patches13 repliesSuperseded

Changes in v17 from the cover letter

- A couple minor improvements to documentation from review suggestions
- chrdev_lock redeclared as atomic_t; BITMAP was not necessary because chrdev_lock is a single flag
- test_and_set_bit_lock(), clear_bit_unlock(), and clear_bit(), replaced respectively with atomic_add_unless(), atomic_dec(), and atomic_set()
- counter_comp_read_is_equal() and counter_comp_read_is_set() macros implemented in order to properly test counter_comp structures' read callback states
- counter_sysfs_add() call performed before counter_chrdev_add() call in counter_register() in order to match unwinding sequence
- for-loop utilized in counter-example.c in order to simplify code
- counter-example.c returns 1 on error instead of -errno; errno may be modified after a subsequent library call so we can't depend on it

Patches in v17 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9counter: Move counter enums to uapi headerMAINTAINERS include/linux/counter.h include/uapi/linux/counter.h+58 -410 replies
2/9counter: Add character device interfacedrivers/counter/Makefile drivers/counter/counter-chrdev.c drivers/counter/counter-chrdev.h +3 more+798 -64 replies
3/9docs: counter: Document character device interfaceDocumentation/driver-api/generic-counter.rst Documentation/userspace-api/ioctl/ioctl-number.rst+137 -410 replies
4/9tools/counter: Create Counter toolsMAINTAINERS tools/Makefile tools/counter/Build +2 more+154 -60 replies
5/9counter: Implement signalZ_action_component_id sysfs attributeDocumentation/ABI/testing/sysfs-bus-counter drivers/counter/counter-sysfs.c+52 -01 reply
6/9counter: Implement *_component_id sysfs attributesDocumentation/ABI/testing/sysfs-bus-counter drivers/counter/counter-sysfs.c+42 -70 replies
7/9counter: Implement events_queue_size sysfs attributeDocumentation/ABI/testing/sysfs-bus-counter drivers/counter/counter-sysfs.c+53 -00 replies
8/9counter: 104-quad-8: Replace mutex with spinlockdrivers/counter/104-quad-8.c+52 -370 replies
9/9counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8drivers/counter/104-quad-8.c drivers/counter/Kconfig+164 -90 replies

Reviews trailers per patch

4 of 9 patches have a Reviewed-by or Acked-by.

PatchDavid LechnerSyed Nayyar Waris
1/9R-b
2/9
3/9
4/9
5/9R-b
6/9
7/9
8/9A-b
9/9A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v17 thread

Cover letter [PATCH v17 0/9] Introduce the Counter character device interface

Changes in v17:
- A couple minor improvements to documentation from review suggestions
- chrdev_lock redeclared as atomic_t; BITMAP was not necessary because chrdev_lock is a single flag
- test_and_set_bit_lock(), clear_bit_unlock(), and clear_bit(), replaced respectively with atomic_add_unless(), atomic_dec(), and atomic_set()
- counter_comp_read_is_equal() and counter_comp_read_is_set() macros implemented in order to properly test counter_comp structures' read callback states
- counter_sysfs_add() call performed before counter_chrdev_add() call in counter_register() in order to match unwinding sequence
- for-loop utilized in counter-example.c in order to simplify code
- counter-example.c returns 1 on error instead of -errno; errno may be modified after a subsequent library call so we can't depend on it

For convenience, this patchset is also available on my personal git
repo: https://gitlab.com/vilhelmgray/iio/-/tree/counter_chrdev_v17

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 (9):
counter: Move counter enums to uapi header
counter: Add character device interface
docs: counter: Document character device interface tools/counter: Create Counter tools
counter: Implement signalZ_action_component_id sysfs attribute
counter: Implement *_component_id sysfs attributes
counter: Implement events_queue_size sysfs attribute
counter: 104-quad-8: Replace mutex with spinlock
counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8

 Documentation/ABI/testing/sysfs-bus-counter   |  29 +
 Documentation/driver-api/generic-counter.rst  | 177 ++++--
 .../userspace-api/ioctl/ioctl-number.rst      |   1 +
 MAINTAINERS                                   |   2 +
 drivers/counter/104-quad-8.c                  | 256 ++++++--
 drivers/counter/Kconfig                       |   6 +-
 drivers/counter/Makefile                      |   2 +-
 drivers/counter/counter-chrdev.c              | 578 ++++++++++++++++++
 drivers/counter/counter-chrdev.h              |  14 +
 drivers/counter/counter-core.c                |  56 +-
 drivers/counter/counter-sysfs.c               | 123 +++-
 include/linux/counter.h                       |  98 +--
 include/uapi/linux/counter.h                  | 154 +++++
 tools/Makefile                                |  13 +-
 tools/counter/Build                           |   1 +
 tools/counter/Makefile                        |  53 ++
 tools/counter/counter_example.c               |  92 +++
 17 files changed, 1509 insertions(+), 146 deletions(-)
 create mode 100644 drivers/counter/counter-chrdev.c
 create mode 100644 drivers/counter/counter-chrdev.h
 create mode 100644 include/uapi/linux/counter.h
 create mode 100644 tools/counter/Build
 create mode 100644 tools/counter/Makefile
 create mode 100644 tools/counter/counter_example.c

base-commit: a5ae0cfd53aaf031c2e9ba048281776fa67047c2

Signature · 1 line
2.33.0