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:
parent
bb4d710d62
commit
a18e4e85e9
|
@ -440,6 +440,7 @@ void pm_wakelock_staytimeout(FAR struct pm_wakelock_s *wakelock, int ms)
|
||||||
FAR struct pm_domain_s *pdom;
|
FAR struct pm_domain_s *pdom;
|
||||||
FAR struct dq_queue_s *dq;
|
FAR struct dq_queue_s *dq;
|
||||||
FAR struct wdog_s *wdog;
|
FAR struct wdog_s *wdog;
|
||||||
|
bool wdstart = false;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int domain;
|
int domain;
|
||||||
|
|
||||||
|
@ -466,10 +467,14 @@ void pm_wakelock_staytimeout(FAR struct pm_wakelock_s *wakelock, int ms)
|
||||||
|
|
||||||
if (TICK2MSEC(wd_gettime(wdog)) < 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);
|
spin_unlock_irqrestore(&pdom->lock, flags);
|
||||||
|
if (wdstart)
|
||||||
|
{
|
||||||
|
wd_start(wdog, MSEC2TICK(ms), pm_waklock_cb, (wdparm_t)wakelock);
|
||||||
|
}
|
||||||
|
|
||||||
pm_auto_updatestate(domain);
|
pm_auto_updatestate(domain);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue