rk: earlysuspend: only works on system is running
author黄涛 <huangtao@rock-chips.com>
Thu, 31 May 2012 01:28:26 +0000 (09:28 +0800)
committer黄涛 <huangtao@rock-chips.com>
Thu, 31 May 2012 01:43:26 +0000 (09:43 +0800)
kernel/power/earlysuspend.c

index ba5e9763a8a3ae4c891330949b9d3461e9f61b59..11d476062245c241758e26c7d967d5aad709f9a6 100644 (file)
@@ -77,6 +77,11 @@ static void early_suspend(struct work_struct *work)
        unsigned long irqflags;
        int abort = 0;
 
+#ifdef CONFIG_PLAT_RK
+       if (system_state != SYSTEM_RUNNING)
+               return;
+#endif
+
        mutex_lock(&early_suspend_lock);
        spin_lock_irqsave(&state_lock, irqflags);
        if (state == SUSPEND_REQUESTED)
@@ -124,6 +129,11 @@ static void late_resume(struct work_struct *work)
        unsigned long irqflags;
        int abort = 0;
 
+#ifdef CONFIG_PLAT_RK
+       if (system_state != SYSTEM_RUNNING)
+               return;
+#endif
+
        mutex_lock(&early_suspend_lock);
        spin_lock_irqsave(&state_lock, irqflags);
        if (state == SUSPENDED)
@@ -158,6 +168,11 @@ void request_suspend_state(suspend_state_t new_state)
        unsigned long irqflags;
        int old_sleep;
 
+#ifdef CONFIG_PLAT_RK
+       if (system_state != SYSTEM_RUNNING)
+               return;
+#endif
+
        spin_lock_irqsave(&state_lock, irqflags);
        old_sleep = state & SUSPEND_REQUESTED;
        if (debug_mask & DEBUG_USER_STATE) {