]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/base/power/wakeup.c
PM / Sleep: Print name of wakeup source that aborts suspend
[mirror_ubuntu-artful-kernel.git] / drivers / base / power / wakeup.c
index cbb463b3a750e30bc70d7d8de40ff7555e7670ee..8a0a9ca6ad65f4534892a1ce45bd2b25d1253bc3 100644 (file)
@@ -649,6 +649,31 @@ void pm_wakeup_event(struct device *dev, unsigned int msec)
 }
 EXPORT_SYMBOL_GPL(pm_wakeup_event);
 
+static void print_active_wakeup_sources(void)
+{
+       struct wakeup_source *ws;
+       int active = 0;
+       struct wakeup_source *last_activity_ws = NULL;
+
+       rcu_read_lock();
+       list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
+               if (ws->active) {
+                       pr_info("active wakeup source: %s\n", ws->name);
+                       active = 1;
+               } else if (!active &&
+                          (!last_activity_ws ||
+                           ktime_to_ns(ws->last_time) >
+                           ktime_to_ns(last_activity_ws->last_time))) {
+                       last_activity_ws = ws;
+               }
+       }
+
+       if (!active && last_activity_ws)
+               pr_info("last active wakeup source: %s\n",
+                       last_activity_ws->name);
+       rcu_read_unlock();
+}
+
 /**
  * pm_wakeup_pending - Check if power transition in progress should be aborted.
  *
@@ -671,6 +696,10 @@ bool pm_wakeup_pending(void)
                events_check_enabled = !ret;
        }
        spin_unlock_irqrestore(&events_lock, flags);
+
+       if (ret)
+               print_active_wakeup_sources();
+
        return ret;
 }