]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/base/power/suspend.c
Merge branch 'upstream'
[linux-2.6-omap-h63xx.git] / drivers / base / power / suspend.c
index 8660779fb288b3a29b1401b110ec2bd3289dfc15..662209d3f42d6a551c7001ab5adb62406abfcfb0 100644 (file)
@@ -8,7 +8,10 @@
  *
  */
 
+#include <linux/vt_kern.h>
 #include <linux/device.h>
+#include <linux/kallsyms.h>
+#include <linux/pm.h>
 #include "../base.h"
 #include "power.h"
 
@@ -57,12 +60,12 @@ int suspend_device(struct device * dev, pm_message_t state)
        if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
                dev_dbg(dev, "suspending\n");
                error = dev->bus->suspend(dev, state);
+               suspend_report_result(dev->bus->suspend, error);
        }
        up(&dev->sem);
        return error;
 }
 
-
 /**
  *     device_suspend - Save state and stop all devices in system.
  *     @state:         Power state to put each device in.
@@ -82,6 +85,9 @@ int device_suspend(pm_message_t state)
 {
        int error = 0;
 
+       if (!is_console_suspend_safe())
+               return -EINVAL;
+
        down(&dpm_sem);
        down(&dpm_list_sem);
        while (!list_empty(&dpm_active) && error == 0) {
@@ -166,3 +172,12 @@ int device_power_down(pm_message_t state)
 
 EXPORT_SYMBOL_GPL(device_power_down);
 
+void __suspend_report_result(const char *function, void *fn, int ret)
+{
+       if (ret) {
+               printk(KERN_ERR "%s(): ", function);
+               print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn);
+               printk("%d\n", ret);
+       }
+}
+EXPORT_SYMBOL_GPL(__suspend_report_result);