aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/counter/interrupt-cnt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/counter/interrupt-cnt.c')
-rw-r--r--drivers/counter/interrupt-cnt.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/counter/interrupt-cnt.c b/drivers/counter/interrupt-cnt.c
index 5df7cd13d4c7..1de4243db488 100644
--- a/drivers/counter/interrupt-cnt.c
+++ b/drivers/counter/interrupt-cnt.c
@@ -107,13 +107,16 @@ static int interrupt_cnt_write(struct counter_device *counter,
{
struct interrupt_cnt_priv *priv = counter->priv;
+ if (val != (typeof(priv->count.counter))val)
+ return -ERANGE;
+
atomic_set(&priv->count, val);
return 0;
}
-static const enum counter_count_function interrupt_cnt_functions[] = {
- COUNTER_COUNT_FUNCTION_INCREASE,
+static const enum counter_function interrupt_cnt_functions[] = {
+ COUNTER_FUNCTION_INCREASE,
};
static int interrupt_cnt_function_get(struct counter_device *counter,
@@ -127,7 +130,7 @@ static int interrupt_cnt_function_get(struct counter_device *counter,
static int interrupt_cnt_signal_read(struct counter_device *counter,
struct counter_signal *signal,
- enum counter_signal_value *val)
+ enum counter_signal_level *level)
{
struct interrupt_cnt_priv *priv = counter->priv;
int ret;
@@ -139,7 +142,7 @@ static int interrupt_cnt_signal_read(struct counter_device *counter,
if (ret < 0)
return ret;
- *val = ret ? COUNTER_SIGNAL_HIGH : COUNTER_SIGNAL_LOW;
+ *level = ret ? COUNTER_SIGNAL_LEVEL_HIGH : COUNTER_SIGNAL_LEVEL_LOW;
return 0;
}