This is an automated email from the ASF dual-hosted git repository.
xiaoxiang 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 30188dc587 watchdog: fix idle callback maybe not upperhalf
30188dc587 is described below
commit 30188dc587a93a6c76854096e358973d68505d0b
Author: buxiasen <[email protected]>
AuthorDate: Fri May 31 21:06:35 2024 +0800
watchdog: fix idle callback maybe not upperhalf
Signed-off-by: buxiasen <[email protected]>
---
drivers/timers/watchdog.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/timers/watchdog.c b/drivers/timers/watchdog.c
index c055776b1c..e16e8d9244 100644
--- a/drivers/timers/watchdog.c
+++ b/drivers/timers/watchdog.c
@@ -23,6 +23,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <nuttx/nuttx.h>
#include <sys/types.h>
#include <stdint.h>
@@ -213,8 +214,11 @@ static void watchdog_automonitor_worker(FAR void *arg)
static void watchdog_automonitor_idle(FAR struct pm_callback_s *cb,
int domain, enum pm_state_e pmstate)
{
- FAR struct watchdog_upperhalf_s *upper = (FAR void *)cb;
- FAR struct watchdog_lowerhalf_s *lower = upper->lower;
+ FAR struct watchdog_upperhalf_s *upper;
+ FAR struct watchdog_lowerhalf_s *lower;
+
+ upper = container_of(cb, struct watchdog_upperhalf_s, idle);
+ lower = upper->lower;
if (domain == PM_IDLE_DOMAIN &&
pmstate != PM_RESTORE && upper->monitor)