* [PATCH] counter: interrupt-cnt: Implement watch_validate callback
@ 2022-08-15 22:50 William Breathitt Gray
2022-09-19 16:29 ` William Breathitt Gray
0 siblings, 1 reply; 2+ messages in thread
From: William Breathitt Gray @ 2022-08-15 22:50 UTC (permalink / raw)
To: linux, kernel; +Cc: linux-iio, linux-kernel, William Breathitt Gray
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>
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 3b13f56bbb11..05a5d3e2d2b0 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)
base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] counter: interrupt-cnt: Implement watch_validate callback
2022-08-15 22:50 [PATCH] counter: interrupt-cnt: Implement watch_validate callback William Breathitt Gray
@ 2022-09-19 16:29 ` William Breathitt Gray
0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2022-09-19 16:29 UTC (permalink / raw)
To: William Breathitt Gray; +Cc: linux, kernel, linux-iio, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
On Mon, Aug 15, 2022 at 06:50:58PM -0400, William Breathitt Gray wrote:
> 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>
> Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Applied to counter-next.
William Breathitt Gray
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-19 16:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 22:50 [PATCH] counter: interrupt-cnt: Implement watch_validate callback William Breathitt Gray
2022-09-19 16:29 ` William Breathitt Gray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).