pm_activity: fix deadlock with spinlock and critcal_section

critical_section is not compatible with irq disabled, have to delay the
wd_start after spin_unlock_irqrestore.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen 2024-08-05 19:54:56 +08:00 committed by Alan Carvalho de Assis
parent bb4d710d62
commit a18e4e85e9
1 changed files with 6 additions and 1 deletions

View File

@ -440,6 +440,7 @@ void pm_wakelock_staytimeout(FAR struct pm_wakelock_s *wakelock, int ms)
FAR struct pm_domain_s *pdom;
FAR struct dq_queue_s *dq;
FAR struct wdog_s *wdog;
bool wdstart = false;
irqstate_t flags;
int domain;
@ -466,10 +467,14 @@ void pm_wakelock_staytimeout(FAR struct pm_wakelock_s *wakelock, int ms)
if (TICK2MSEC(wd_gettime(wdog)) < ms)
{
wd_start(wdog, MSEC2TICK(ms), pm_waklock_cb, (wdparm_t)wakelock);
wdstart = true;
}
spin_unlock_irqrestore(&pdom->lock, flags);
if (wdstart)
{
wd_start(wdog, MSEC2TICK(ms), pm_waklock_cb, (wdparm_t)wakelock);
}
pm_auto_updatestate(domain);
}