From e6d2ff668b08d8e2c962ddd15cb75cbf87424f05 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 28 Feb 2022 17:15:04 +0100 Subject: [PATCH] drivers/dose: only disable watchdog when transiting from RECV state The DOSE watchdog should only run if at least one interface is in RECV state. That means it must be enabled when entering RECV state and disabled when leaving RECV state. The watchdog was *always* disabled on a transition to IDLE. This is wrong: If there are two interfaces and one is in RECV state but the other did just SEND something and transitions to IDLE state from SEND state, it would still disable the watchdog. Fix this by only disabling the watchdog if the current state is RECV. --- drivers/dose/dose.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dose/dose.c b/drivers/dose/dose.c index b7784e0669..58f9a64fdf 100644 --- a/drivers/dose/dose.c +++ b/drivers/dose/dose.c @@ -201,12 +201,12 @@ static dose_signal_t state_transit_idle(dose_t *ctx, dose_signal_t signal) (void) ctx; (void) signal; - _watchdog_stop(); - if (ctx->state == DOSE_STATE_RECV) { bool dirty = ctx->flags & DOSE_FLAG_RECV_BUF_DIRTY; bool done = ctx->flags & DOSE_FLAG_END_RECEIVED; + _watchdog_stop(); + /* We got here from RECV state. The driver's thread has to look * if this frame should be processed. By queuing NETDEV_EVENT_ISR, * the netif thread will call _isr at some time. */