Commit 7c71feb0 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by John Stultz

timer: Avoid using timespec

The tstats_show() function prints a ktime_t variable by converting
it to struct timespec first. The algorithm is ok, but we want to
stop using timespec in general because of the 32-bit time_t
overflow problem.

This changes the code to use struct timespec64, without any
functional change.

Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 4a19bd3d
...@@ -279,7 +279,7 @@ static void print_name_offset(struct seq_file *m, unsigned long addr) ...@@ -279,7 +279,7 @@ static void print_name_offset(struct seq_file *m, unsigned long addr)
static int tstats_show(struct seq_file *m, void *v) static int tstats_show(struct seq_file *m, void *v)
{ {
struct timespec period; struct timespec64 period;
struct entry *entry; struct entry *entry;
unsigned long ms; unsigned long ms;
long events = 0; long events = 0;
...@@ -295,11 +295,11 @@ static int tstats_show(struct seq_file *m, void *v) ...@@ -295,11 +295,11 @@ static int tstats_show(struct seq_file *m, void *v)
time = ktime_sub(time_stop, time_start); time = ktime_sub(time_stop, time_start);
period = ktime_to_timespec(time); period = ktime_to_timespec64(time);
ms = period.tv_nsec / 1000000; ms = period.tv_nsec / 1000000;
seq_puts(m, "Timer Stats Version: v0.3\n"); seq_puts(m, "Timer Stats Version: v0.3\n");
seq_printf(m, "Sample period: %ld.%03ld s\n", period.tv_sec, ms); seq_printf(m, "Sample period: %ld.%03ld s\n", (long)period.tv_sec, ms);
if (atomic_read(&overflow_count)) if (atomic_read(&overflow_count))
seq_printf(m, "Overflow: %d entries\n", atomic_read(&overflow_count)); seq_printf(m, "Overflow: %d entries\n", atomic_read(&overflow_count));
seq_printf(m, "Collection: %s\n", timer_stats_active ? "active" : "inactive"); seq_printf(m, "Collection: %s\n", timer_stats_active ? "active" : "inactive");
......
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