aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/wakeup.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/wakeup.c')
-rw-r--r--drivers/base/power/wakeup.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index c313b600d356..9c36b27996fc 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -28,8 +28,8 @@ bool events_check_enabled __read_mostly;
28/* First wakeup IRQ seen by the kernel in the last cycle. */ 28/* First wakeup IRQ seen by the kernel in the last cycle. */
29unsigned int pm_wakeup_irq __read_mostly; 29unsigned int pm_wakeup_irq __read_mostly;
30 30
31/* If set and the system is suspending, terminate the suspend. */ 31/* If greater than 0 and the system is suspending, terminate the suspend. */
32static bool pm_abort_suspend __read_mostly; 32static atomic_t pm_abort_suspend __read_mostly;
33 33
34/* 34/*
35 * Combined counters of registered wakeup events and wakeup events in progress. 35 * Combined counters of registered wakeup events and wakeup events in progress.
@@ -855,20 +855,26 @@ bool pm_wakeup_pending(void)
855 pm_print_active_wakeup_sources(); 855 pm_print_active_wakeup_sources();
856 } 856 }
857 857
858 return ret || pm_abort_suspend; 858 return ret || atomic_read(&pm_abort_suspend) > 0;
859} 859}
860 860
861void pm_system_wakeup(void) 861void pm_system_wakeup(void)
862{ 862{
863 pm_abort_suspend = true; 863 atomic_inc(&pm_abort_suspend);
864 freeze_wake(); 864 freeze_wake();
865} 865}
866EXPORT_SYMBOL_GPL(pm_system_wakeup); 866EXPORT_SYMBOL_GPL(pm_system_wakeup);
867 867
868void pm_wakeup_clear(void) 868void pm_system_cancel_wakeup(void)
869{
870 atomic_dec(&pm_abort_suspend);
871}
872
873void pm_wakeup_clear(bool reset)
869{ 874{
870 pm_abort_suspend = false;
871 pm_wakeup_irq = 0; 875 pm_wakeup_irq = 0;
876 if (reset)
877 atomic_set(&pm_abort_suspend, 0);
872} 878}
873 879
874void pm_system_irq_wakeup(unsigned int irq_number) 880void pm_system_irq_wakeup(unsigned int irq_number)