• NeilBrown's avatar
    RTC: Avoid races between RTC alarm wakeup and suspend. · 7523ceed
    NeilBrown authored
    If an RTC alarm fires just as suspend is happening, it is possible for
    suspend to complete and the alarm to be missed.
    
    To avoid the race, we must register the event with the PM core.
    
    As the event is made visible to userspace through a thread which is
    only scheduled by the interrupt, we need a pm_stay_awake/pm_relax
    pair preventing suspend from the interrupt until the thread completes
    its work.
    
    This makes the pm_wakeup_event() call in cmos_interrupt unnecessary as
    it provides suspend protection for all RTCs that use rtc_update_irq.
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
    7523ceed
rtc-cmos.c 29.1 KB