This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 110ab50f50 sched/wdog: Revert wd_cancel semantics
110ab50f50 is described below
commit 110ab50f50c8c7f1dc704dee01400eac7994a46b
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Wed Oct 9 21:22:55 2024 +0800
sched/wdog: Revert wd_cancel semantics
In the original implementation, if wdog is not ACTIVE, -EINVAL will be
returned. The rp2040 i2c driver relies on this semantics to correctly release
the semaphore.
Signed-off-by: ouyangxiangzhen <[email protected]>
---
sched/wdog/wd_cancel.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/sched/wdog/wd_cancel.c b/sched/wdog/wd_cancel.c
index 538fa03e6b..858d07eacb 100644
--- a/sched/wdog/wd_cancel.c
+++ b/sched/wdog/wd_cancel.c
@@ -91,7 +91,7 @@ int wd_cancel(FAR struct wdog_s *wdog)
int wd_cancel_irq(FAR struct wdog_s *wdog)
{
- if (wdog == NULL)
+ if (wdog == NULL || !WDOG_ISACTIVE(wdog))
{
return -EINVAL;
}
@@ -105,27 +105,24 @@ int wd_cancel_irq(FAR struct wdog_s *wdog)
/* Make sure that the watchdog is still active. */
- if (WDOG_ISACTIVE(wdog))
- {
- bool head = list_is_head(&g_wdactivelist, &wdog->node);
+ bool head = list_is_head(&g_wdactivelist, &wdog->node);
- /* Now, remove the watchdog from the timer queue */
+ /* Now, remove the watchdog from the timer queue */
- list_delete(&wdog->node);
+ list_delete(&wdog->node);
- /* Mark the watchdog inactive */
+ /* Mark the watchdog inactive */
- wdog->func = NULL;
+ wdog->func = NULL;
- if (head)
- {
- /* If the watchdog is at the head of the timer queue, then
- * we will need to re-adjust the interval timer that will
- * generate the next interval event.
- */
+ if (head)
+ {
+ /* If the watchdog is at the head of the timer queue, then
+ * we will need to re-adjust the interval timer that will
+ * generate the next interval event.
+ */
- nxsched_reassess_timer();
- }
+ nxsched_reassess_timer();
}
return OK;