Merge branch 'develop-3.0' of ssh://192.168.1.29/rk/kernel into develop-3.0
[firefly-linux-kernel-4.4.55.git] / kernel / power / earlysuspend.c
index 84bed51dcdce79503d718186775e690560d4637b..86e14ef1898c26045b644d8307f2e70bc0f86781 100644 (file)
@@ -26,8 +26,9 @@
 enum {
        DEBUG_USER_STATE = 1U << 0,
        DEBUG_SUSPEND = 1U << 2,
+       DEBUG_VERBOSE = 1U << 3,
 };
-static int debug_mask = DEBUG_USER_STATE;
+static int debug_mask = DEBUG_USER_STATE | DEBUG_SUSPEND | DEBUG_VERBOSE;
 module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
 
 static DEFINE_MUTEX(early_suspend_lock);
@@ -94,8 +95,11 @@ static void early_suspend(struct work_struct *work)
        if (debug_mask & DEBUG_SUSPEND)
                pr_info("early_suspend: call handlers\n");
        list_for_each_entry(pos, &early_suspend_handlers, link) {
-               if (pos->suspend != NULL)
+               if (pos->suspend != NULL) {
+                       if (debug_mask & DEBUG_VERBOSE)
+                               pr_info("early_suspend: calling %pf\n", pos->suspend);
                        pos->suspend(pos);
+               }
        }
        mutex_unlock(&early_suspend_lock);
 
@@ -103,6 +107,8 @@ static void early_suspend(struct work_struct *work)
                pr_info("early_suspend: sync\n");
 
        sys_sync();
+       if (debug_mask & DEBUG_SUSPEND)
+               pr_info("early_suspend: done\n");
 abort:
        spin_lock_irqsave(&state_lock, irqflags);
        if (state == SUSPEND_REQUESTED_AND_SUSPENDED)
@@ -131,9 +137,14 @@ static void late_resume(struct work_struct *work)
        }
        if (debug_mask & DEBUG_SUSPEND)
                pr_info("late_resume: call handlers\n");
-       list_for_each_entry_reverse(pos, &early_suspend_handlers, link)
-               if (pos->resume != NULL)
+       list_for_each_entry_reverse(pos, &early_suspend_handlers, link) {
+               if (pos->resume != NULL) {
+                       if (debug_mask & DEBUG_VERBOSE)
+                               pr_info("late_resume: calling %pf\n", pos->resume);
+
                        pos->resume(pos);
+               }
+       }
        if (debug_mask & DEBUG_SUSPEND)
                pr_info("late_resume: done\n");
 abort: