Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 143711f0 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Rafael J. Wysocki
Browse files

PM / core: Simplify initcall_debug_report() timing



initcall_debug_report() always called ktime_get(), even if we didn't
need the result.

Change it so we only call it when we're going to use the result, and
change initcall_debug_start() to follow the same style.

Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 147f2979
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -194,16 +194,13 @@ void device_pm_move_last(struct device *dev)

static ktime_t initcall_debug_start(struct device *dev)
{
	ktime_t calltime = 0;
	if (!pm_print_times_enabled)
		return 0;

	if (pm_print_times_enabled) {
	pr_info("calling  %s+ @ %i, parent: %s\n",
		dev_name(dev), task_pid_nr(current),
		dev->parent ? dev_name(dev->parent) : "none");
		calltime = ktime_get();
	}

	return calltime;
	return ktime_get();
}

static void initcall_debug_report(struct device *dev, ktime_t calltime,
@@ -212,14 +209,15 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime,
	ktime_t rettime;
	s64 nsecs;

	if (!pm_print_times_enabled)
		return;

	rettime = ktime_get();
	nsecs = (s64) ktime_to_ns(ktime_sub(rettime, calltime));

	if (pm_print_times_enabled) {
	pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
		error, (unsigned long long)nsecs >> 10);
}
}

/**
 * dpm_wait - Wait for a PM operation to complete.