counter: interrupt-cnt: add counter_push_event()
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 15 Mar 2022 19:38:55 +0000 (15:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Mar 2022 13:04:30 +0000 (14:04 +0100)
Add counter_push_event() to notify user space about new pulses

Link: https://lore.kernel.org/r/20220203135727.2374052-3-o.rempel@pengutronix.de
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/9da3460113b5092e8658e12f23578567aab7cc5f.1647373009.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/counter/interrupt-cnt.c

index 9e99702..3b13f56 100644 (file)
@@ -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;