Skip to content

Commit 66871ce

Browse files
Fix-Pointxiaoxiang781216
authored andcommitted
sched/wdog: move g_wdtimernested to wd_start.c
This patch moved the g_wdtimernested to wd_start.c Signed-off-by: ouyangxiangzhen <[email protected]> Signed-off-by: ligd <[email protected]>
1 parent 50f801d commit 66871ce

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

sched/sched/sched_timerexpiration.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,7 @@ void nxsched_alarm_tick_expiration(clock_t ticks)
528528

529529
/* Process the timer ticks and set up the next interval (or not) */
530530

531-
g_wdtimernested++;
532531
nexttime = nxsched_timer_process(ticks, elapsed, false);
533-
g_wdtimernested--;
534532

535533
nxsched_timer_start(nexttime);
536534
#ifdef CONFIG_SMP

sched/wdog/wd_initialize.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@
3939

4040
struct list_node g_wdactivelist = LIST_INITIAL_VALUE(g_wdactivelist);
4141

42-
#ifdef CONFIG_SCHED_TICKLESS
43-
unsigned int g_wdtimernested;
44-
#endif
45-
4642
/****************************************************************************
4743
* Public Functions
4844
****************************************************************************/

sched/wdog/wd_start.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@
6969
# define CALL_FUNC(func, arg) func(arg)
7070
#endif
7171

72+
/****************************************************************************
73+
* Private Data
74+
****************************************************************************/
75+
76+
#ifdef CONFIG_SCHED_TICKLESS
77+
static unsigned int g_wdtimernested;
78+
#endif
79+
7280
/****************************************************************************
7381
* Private Functions
7482
****************************************************************************/
@@ -93,6 +101,14 @@ static inline_function void wd_expiration(clock_t ticks)
93101
FAR struct wdog_s *wdog;
94102
wdentry_t func;
95103

104+
#ifdef CONFIG_SCHED_TICKLESS
105+
/* Increment the nested watchdog timer count to handle cases where wd_start
106+
* is called in the watchdog callback functions.
107+
*/
108+
109+
g_wdtimernested++;
110+
#endif
111+
96112
/* Process the watchdog at the head of the list as well as any
97113
* other watchdogs that became ready to run at this time
98114
*/
@@ -122,6 +138,12 @@ static inline_function void wd_expiration(clock_t ticks)
122138
up_setpicbase(wdog->picbase);
123139
CALL_FUNC(func, wdog->arg);
124140
}
141+
142+
#ifdef CONFIG_SCHED_TICKLESS
143+
/* Decrement the nested watchdog timer count */
144+
145+
g_wdtimernested--;
146+
#endif
125147
}
126148

127149
/****************************************************************************

sched/wdog/wdog.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ extern "C"
6363

6464
extern struct list_node g_wdactivelist;
6565

66-
#ifdef CONFIG_SCHED_TICKLESS
67-
extern unsigned int g_wdtimernested;
68-
#endif
69-
7066
/****************************************************************************
7167
* Public Function Prototypes
7268
****************************************************************************/

0 commit comments

Comments
 (0)