Commit 7f817ba9 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Rafael J. Wysocki

PM / core: Use dev_printk() and symbols in suspend/resume diagnostics

When we print diagnostic messages about suspend/resume, we have a device
pointer, so use dev_printk() to match other device-related things.  Add the
function name, similar to initcall_debug output.  E.g.,

  - calling  0000:01:00.0+ @ 998, parent: 0000:00:1c.0
  + pci 0000:01:00.0: calling <something> @ 998, parent: 0000:00:1c.0

I wondered if this would break scripts/bootgraph.pl, but I don't think it
will because bootgraph.pl doesn't add any timing information to $start{}
after it sees "Write protecting the" or "Freeing unused kernel memory".
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 143711f0
...@@ -192,19 +192,19 @@ void device_pm_move_last(struct device *dev) ...@@ -192,19 +192,19 @@ void device_pm_move_last(struct device *dev)
list_move_tail(&dev->power.entry, &dpm_list); list_move_tail(&dev->power.entry, &dpm_list);
} }
static ktime_t initcall_debug_start(struct device *dev) static ktime_t initcall_debug_start(struct device *dev, void *cb)
{ {
if (!pm_print_times_enabled) if (!pm_print_times_enabled)
return 0; return 0;
pr_info("calling %s+ @ %i, parent: %s\n", dev_info(dev, "calling %pF @ %i, parent: %s\n", cb,
dev_name(dev), task_pid_nr(current), task_pid_nr(current),
dev->parent ? dev_name(dev->parent) : "none"); dev->parent ? dev_name(dev->parent) : "none");
return ktime_get(); return ktime_get();
} }
static void initcall_debug_report(struct device *dev, ktime_t calltime, static void initcall_debug_report(struct device *dev, ktime_t calltime,
int error) void *cb, int error)
{ {
ktime_t rettime; ktime_t rettime;
s64 nsecs; s64 nsecs;
...@@ -215,8 +215,8 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime, ...@@ -215,8 +215,8 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime,
rettime = ktime_get(); rettime = ktime_get();
nsecs = (s64) ktime_to_ns(ktime_sub(rettime, calltime)); nsecs = (s64) ktime_to_ns(ktime_sub(rettime, calltime));
pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), dev_info(dev, "%pF returned %d after %Ld usecs\n", cb, error,
error, (unsigned long long)nsecs >> 10); (unsigned long long)nsecs >> 10);
} }
/** /**
...@@ -443,7 +443,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev, ...@@ -443,7 +443,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev,
if (!cb) if (!cb)
return 0; return 0;
calltime = initcall_debug_start(dev); calltime = initcall_debug_start(dev, cb);
pm_dev_dbg(dev, state, info); pm_dev_dbg(dev, state, info);
trace_device_pm_callback_start(dev, info, state.event); trace_device_pm_callback_start(dev, info, state.event);
...@@ -451,7 +451,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev, ...@@ -451,7 +451,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev,
trace_device_pm_callback_end(dev, error); trace_device_pm_callback_end(dev, error);
suspend_report_result(cb, error); suspend_report_result(cb, error);
initcall_debug_report(dev, calltime, error); initcall_debug_report(dev, calltime, cb, error);
return error; return error;
} }
...@@ -1661,14 +1661,14 @@ static int legacy_suspend(struct device *dev, pm_message_t state, ...@@ -1661,14 +1661,14 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
int error; int error;
ktime_t calltime; ktime_t calltime;
calltime = initcall_debug_start(dev); calltime = initcall_debug_start(dev, cb);
trace_device_pm_callback_start(dev, info, state.event); trace_device_pm_callback_start(dev, info, state.event);
error = cb(dev, state); error = cb(dev, state);
trace_device_pm_callback_end(dev, error); trace_device_pm_callback_end(dev, error);
suspend_report_result(cb, error); suspend_report_result(cb, error);
initcall_debug_report(dev, calltime, error); initcall_debug_report(dev, calltime, cb, error);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment