alarmtimer: Don't fail on wakeup

Userspace abuses alarmtimers, let's relax the check and not fail suspend.

Change-Id: I0dc7e3988e98c573676b618c71d575ba81966a5a
Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
celtare21 2021-11-12 01:14:03 +05:30 committed by Richard Raya
parent cf2c1b628e
commit 66f6f139c4

View File

@ -72,7 +72,7 @@ static void alarmtimer_triggered_func(void *p)
if (!(rtc->irq_data & RTC_AF))
return;
__pm_wakeup_event(ws, 2 * MSEC_PER_SEC);
__pm_wakeup_event(ws, MSEC_PER_SEC / 2);
}
static struct rtc_task alarmtimer_rtc_task = {
@ -312,10 +312,8 @@ static int alarmtimer_suspend(struct device *dev)
if (min == 0)
return 0;
if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) {
__pm_wakeup_event(ws, 2 * MSEC_PER_SEC);
return -EBUSY;
}
if (ktime_to_ns(min) < NSEC_PER_SEC / 2)
__pm_wakeup_event(ws, MSEC_PER_SEC / 2);
trace_alarmtimer_suspend(expires, type);
@ -328,7 +326,7 @@ static int alarmtimer_suspend(struct device *dev)
/* Set alarm, if in the past reject suspend briefly to handle */
ret = rtc_timer_start(rtc, &rtctimer, now, 0);
if (ret < 0)
__pm_wakeup_event(ws, MSEC_PER_SEC);
__pm_wakeup_event(ws, MSEC_PER_SEC / 2);
return ret;
}