mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
sched/wdog: Remove flags field from wdog_s to save memory
since WDOG_ISACTIVE can check func field instead Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I21d7f9cfe6195c8ccb6cc5925ff66f3c89822f9d
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
179f5999d9
commit
d7d3177668
@@ -126,8 +126,7 @@ int wd_cancel(FAR struct wdog_s *wdog)
|
||||
|
||||
/* Mark the watchdog inactive */
|
||||
|
||||
wdog->next = NULL;
|
||||
WDOG_CLRACTIVE(wdog);
|
||||
wdog->func = NULL;
|
||||
|
||||
/* Return success */
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
static inline void wd_expiration(void)
|
||||
{
|
||||
FAR struct wdog_s *wdog;
|
||||
wdentry_t func;
|
||||
|
||||
/* Check if the watchdog at the head of the list is ready to run */
|
||||
|
||||
@@ -99,12 +100,13 @@ static inline void wd_expiration(void)
|
||||
|
||||
/* Indicate that the watchdog is no longer active. */
|
||||
|
||||
WDOG_CLRACTIVE(wdog);
|
||||
func = wdog->func;
|
||||
wdog->func = NULL;
|
||||
|
||||
/* Execute the watchdog function */
|
||||
|
||||
up_setpicbase(wdog->picbase);
|
||||
wdog->func(wdog->arg);
|
||||
func(wdog->arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,7 +162,7 @@ int wd_start(FAR struct wdog_s *wdog, int32_t delay,
|
||||
|
||||
/* Verify the wdog and setup parameters */
|
||||
|
||||
if (wdog == NULL || delay < 0)
|
||||
if (wdog == NULL || wdentry == NULL || delay < 0)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -297,7 +299,6 @@ int wd_start(FAR struct wdog_s *wdog, int32_t delay,
|
||||
/* Put the lag into the watchdog structure and mark it as active. */
|
||||
|
||||
wdog->lag = delay;
|
||||
WDOG_SETACTIVE(wdog);
|
||||
|
||||
#ifdef CONFIG_SCHED_TICKLESS
|
||||
/* Resume the interval timer that will generate the next interval event.
|
||||
|
||||
Reference in New Issue
Block a user