Skip to contentSkip to conversation

PM_DEBUG device suspend() messages become informative

PATCH New David Brownell 1 participant 1 message May 17, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM_DEBUG device suspend() messages become informative

Now FREEZE is visibly different from real SUSPEND messages, and when a real suspend is initiated it will report wakeup-enabled devices.

This makes the driver model PM suspend debug messages more useful, by

(a) explaining what event is being sent, since not all suspend()

      requests mean the same thing;

(b) reporting when a PM_EVENT_SUSPEND call is allowing the device to issue wakeup events.

drivers/base/power/suspend.c +16 -1
@@ -30,6 +30,15 @@
  * lists. This way, the ancestors will be accessed before their descendents.
  */
 
+static inline char *suspend_verb(u32 event)
+{
+	switch (event) {
+	case PM_EVENT_SUSPEND:	return "suspend";
+	case PM_EVENT_FREEZE:	return "freeze";
+	default:		return "(unknown suspend event)";
+	}
+}
+
 
 /**
  *	suspend_device - Save state of one device.
@@ -58,7 +67,13 @@ int suspend_device(struct device * dev, 
 	dev->power.prev_state = dev->power.power_state;
 
 	if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
-		dev_dbg(dev, "suspending\n");
+		dev_dbg(dev, "%s%s\n",
+			suspend_verb(state.event),
+			((state.event == PM_EVENT_SUSPEND)
+					&& device_may_wakeup(dev))
+				? ", may wakeup"
+				: ""
+			);
 		error = dev->bus->suspend(dev, state);
 		suspend_report_result(dev->bus->suspend, error);
 	}