From a1614e8c955ebbcdbece8ad8feb4260edc47fb7c Mon Sep 17 00:00:00 2001 From: Minho Jin Date: Tue, 14 Nov 2023 16:50:38 +0900 Subject: [PATCH] driver: counter: rpi_pico_timer: fix counter cancel alarm setting function checks channel callback and it returns -EBUSY if callback is registered. but alarm cancel function doesn't clear callback function. this prevents from alarm setting after alarm cancel Signed-off-by: Minho Jin --- drivers/counter/counter_rpi_pico_timer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/counter/counter_rpi_pico_timer.c b/drivers/counter/counter_rpi_pico_timer.c index 3e1a1dcbb0..40a5aadd49 100644 --- a/drivers/counter/counter_rpi_pico_timer.c +++ b/drivers/counter/counter_rpi_pico_timer.c @@ -106,6 +106,11 @@ static int counter_rpi_pico_timer_set_alarm(const struct device *dev, uint8_t id static int counter_rpi_pico_timer_cancel_alarm(const struct device *dev, uint8_t id) { + struct counter_rpi_pico_timer_data *data = dev->data; + struct counter_rpi_pico_timer_ch_data *chdata = &data->ch_data[id]; + + chdata->callback = NULL; + chdata->user_data = NULL; hardware_alarm_cancel(id); return 0;