First set of new Counter updates, cleanups, and features for 5.18
Only a few changes this cycle, but we do see the addition of a new
COUNTER_EVENT_CHANGE_OF_STATE event type that allows userspace to watch
counter pulses.
Features
* Add new COUNTER_EVENT_CHANGE_OF_STATE. This adds new counter event to
notify user space about every new counter pulse. The interrupt-cnt
driver is the first to use this new feature.
Cleanups
- Add Counter subsystem git tree to MAINTAINERS file.
- Set counter device name. This provides a convenient way to identify
the counter device in devres_log events and similar situations.
- Add defaults to switch-statements. This pacifies warning messages from
Clang static analysis reports.
Driver Updates
* 104-quad-8
- Add COMPILE_TEST depends
* interrupt-cnt
- Add counter_push_event()
Oleksij Rempel (2):
counter: add new COUNTER_EVENT_CHANGE_OF_STATE
counter: interrupt-cnt: add counter_push_event()
Tom Rix (1):
counter: add defaults to switch-statements
William Breathitt Gray (3):
counter: 104-quad-8: Add COMPILE_TEST depends
counter: Set counter device name
MAINTAINERS: Add Counter subsystem git tree
MAINTAINERS | 1 +
drivers/counter/Kconfig | 2 +-
drivers/counter/counter-chrdev.c | 4 ++++
drivers/counter/counter-core.c | 12 +++++++++++-
drivers/counter/interrupt-cnt.c | 7 +++++--
include/uapi/linux/counter.h | 2 ++
6 files changed, 24 insertions(+), 4 deletions(-)
base-commit: 7e57714cd0ad2d5bb90e50b5096a0e671dec1ef3
--
2.35.1
104_QUAD_8 depends on X86, but compiles fine on ARCH=arm. This patch
adds support for COMPILE_TEST which is useful for compile testing code
changes to the driver and Counter subsystem.
Suggested-by: Uwe Kleine-König <[email protected]>
Cc: Syed Nayyar Waris <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: William Breathitt Gray <[email protected]>
---
drivers/counter/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/counter/Kconfig b/drivers/counter/Kconfig
index 3dcdb681c4e4..5edd155f1911 100644
--- a/drivers/counter/Kconfig
+++ b/drivers/counter/Kconfig
@@ -14,7 +14,7 @@ if COUNTER
config 104_QUAD_8
tristate "ACCES 104-QUAD-8 driver"
- depends on PC104 && X86
+ depends on (PC104 && X86) || COMPILE_TEST
select ISA_BUS_API
help
Say yes here to build support for the ACCES 104-QUAD-8 quadrature
--
2.35.1
From: Oleksij Rempel <[email protected]>
Add counter_push_event() to notify user space about new pulses
Signed-off-by: Oleksij Rempel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: William Breathitt Gray <[email protected]>
---
drivers/counter/interrupt-cnt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
index 9e99702470c2..3b13f56bbb11 100644
--- a/drivers/counter/interrupt-cnt.c
+++ b/drivers/counter/interrupt-cnt.c
@@ -26,10 +26,13 @@ struct interrupt_cnt_priv {
static irqreturn_t interrupt_cnt_isr(int irq, void *dev_id)
{
- struct interrupt_cnt_priv *priv = dev_id;
+ struct counter_device *counter = dev_id;
+ struct interrupt_cnt_priv *priv = counter_priv(counter);
atomic_inc(&priv->count);
+ counter_push_event(counter, COUNTER_EVENT_CHANGE_OF_STATE, 0);
+
return IRQ_HANDLED;
}
@@ -209,7 +212,7 @@ static int interrupt_cnt_probe(struct platform_device *pdev)
irq_set_status_flags(priv->irq, IRQ_NOAUTOEN);
ret = devm_request_irq(dev, priv->irq, interrupt_cnt_isr,
IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
- dev_name(dev), priv);
+ dev_name(dev), counter);
if (ret)
return ret;
--
2.35.1