All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-iio@vger.kernel.org,
	William Breathitt Gray <william.gray@linaro.org>,
	Oleksij Rempel <linux@rempel-privat.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>
Subject: [PATCH 03/12] counter: interrupt-cnt: Implement watch_validate callback
Date: Tue, 27 Sep 2022 18:53:37 -0400	[thread overview]
Message-ID: <c50b5eede7d3f523de8dc3937dc44680f2773e1d.1664318353.git.william.gray@linaro.org> (raw)
In-Reply-To: <cover.1664318353.git.william.gray@linaro.org>

The interrupt-cnt counter driver only pushes one type of event on only
one channel: COUNTER_EVENT_CHANGE_OF_STATE on channel 0. The
interrupt_cnt_watch_validate() watch_valid callback is implemented to
ensure watch configurations are valid for this driver.

Cc: Oleksij Rempel <linux@rempel-privat.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Link: https://lore.kernel.org/r/20220815225058.144203-1-william.gray@linaro.org/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
 drivers/counter/interrupt-cnt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
index 5a11b65fc0e5..229473855c5b 100644
--- a/drivers/counter/interrupt-cnt.c
+++ b/drivers/counter/interrupt-cnt.c
@@ -139,12 +139,23 @@ static int interrupt_cnt_signal_read(struct counter_device *counter,
 	return 0;
 }
 
+static int interrupt_cnt_watch_validate(struct counter_device *counter,
+					const struct counter_watch *watch)
+{
+	if (watch->channel != 0 ||
+	    watch->event != COUNTER_EVENT_CHANGE_OF_STATE)
+		return -EINVAL;
+
+	return 0;
+}
+
 static const struct counter_ops interrupt_cnt_ops = {
 	.action_read = interrupt_cnt_action_read,
 	.count_read = interrupt_cnt_read,
 	.count_write = interrupt_cnt_write,
 	.function_read = interrupt_cnt_function_read,
 	.signal_read  = interrupt_cnt_signal_read,
+	.watch_validate  = interrupt_cnt_watch_validate,
 };
 
 static int interrupt_cnt_probe(struct platform_device *pdev)
-- 
2.37.3


  parent reply	other threads:[~2022-09-27 22:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 22:53 [PATCH 00/12] First set of Counter updates for the 6.1 cycle William Breathitt Gray
2022-09-27 22:53 ` [PATCH 01/12] MAINTAINERS: Update Counter subsystem git tree repo link William Breathitt Gray
2022-09-27 22:53 ` [PATCH 02/12] counter: Move symbols into COUNTER namespace William Breathitt Gray
2022-09-27 22:53 ` William Breathitt Gray [this message]
2022-09-27 22:53 ` [PATCH 04/12] counter: Introduce the Signal polarity component William Breathitt Gray
2022-09-27 22:53 ` [PATCH 05/12] counter: 104-quad-8: Add " William Breathitt Gray
2022-09-27 22:53 ` [PATCH 06/12] counter: Introduce the Count capture component William Breathitt Gray
2022-09-27 22:53 ` [PATCH 07/12] counter: Consolidate Counter extension sysfs attribute creation William Breathitt Gray
2022-09-27 22:53 ` [PATCH 08/12] counter: Introduce the COUNTER_COMP_ARRAY component type William Breathitt Gray
2022-09-27 22:53 ` [PATCH 09/12] dt-bindings: counter: add ti,am62-ecap-capture.yaml William Breathitt Gray
2022-09-27 22:53 ` [PATCH 10/12] Documentation: ABI: sysfs-bus-counter: add frequency & num_overflows items William Breathitt Gray
2022-09-27 22:53 ` [PATCH 11/12] counter: ti-ecap-capture: capture driver support for ECAP William Breathitt Gray
2022-09-27 22:53 ` [PATCH 12/12] MAINTAINERS: add TI ECAP driver info William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c50b5eede7d3f523de8dc3937dc44680f2773e1d.1664318353.git.william.gray@linaro.org \
    --to=william.gray@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.