sync: add debugfs support
[linux-2.6.git] / drivers / base / syscore.c
index 90af294..0240f01 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/syscore_ops.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
+#include <linux/interrupt.h>
 
 static LIST_HEAD(syscore_ops_list);
 static DEFINE_MUTEX(syscore_ops_lock);
@@ -48,6 +49,13 @@ int syscore_suspend(void)
        struct syscore_ops *ops;
        int ret = 0;
 
+       pr_debug("Checking wakeup interrupts\n");
+
+       /* Return error code if there are any wakeup interrupts pending. */
+       ret = check_wakeup_irqs();
+       if (ret)
+               return ret;
+
        WARN_ONCE(!irqs_disabled(),
                "Interrupts enabled before system core suspend.\n");
 
@@ -73,6 +81,7 @@ int syscore_suspend(void)
 
        return ret;
 }
+EXPORT_SYMBOL_GPL(syscore_suspend);
 
 /**
  * syscore_resume - Execute all the registered system core resume callbacks.
@@ -88,13 +97,18 @@ void syscore_resume(void)
 
        list_for_each_entry(ops, &syscore_ops_list, node)
                if (ops->resume) {
-                       if (initcall_debug)
-                               pr_info("PM: Calling %pF\n", ops->resume);
                        ops->resume();
                        WARN_ONCE(!irqs_disabled(),
                                "Interrupts enabled after %pF\n", ops->resume);
                }
+       if (initcall_debug) {
+               list_for_each_entry(ops, &syscore_ops_list, node)
+                       if (ops->resume) {
+                               pr_info("PM: Called %pF\n", ops->resume);
+                       }
+       }
 }
+EXPORT_SYMBOL_GPL(syscore_resume);
 #endif /* CONFIG_PM_SLEEP */
 
 /**