Skip to content

Commit a5dec55

Browse files
Li ZefanIngo Molnar
authored andcommitted
tracing: use macros to denote usec and nsec per second
Impact: cleanup Use USEC_PER_SEC and NSEC_PER_SEC instead of 1000000 and 1000000000. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <49CC7870.9000309@cn.fujitsu.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 86665c7 commit a5dec55

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎kernel/trace/trace_boot.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/debugfs.h>
1010
#include <linux/ftrace.h>
1111
#include <linux/kallsyms.h>
12+
#include <linux/time.h>
1213

1314
#include "trace.h"
1415
#include "trace_output.h"
@@ -67,7 +68,7 @@ initcall_call_print_line(struct trace_iterator *iter)
6768
trace_assign_type(field, entry);
6869
call = &field->boot_call;
6970
ts = iter->ts;
70-
nsec_rem = do_div(ts, 1000000000);
71+
nsec_rem = do_div(ts, NSEC_PER_SEC);
7172

7273
ret = trace_seq_printf(s, "[%5ld.%09ld] calling %s @ %i\n",
7374
(unsigned long)ts, nsec_rem, call->func, call->caller);
@@ -92,7 +93,7 @@ initcall_ret_print_line(struct trace_iterator *iter)
9293
trace_assign_type(field, entry);
9394
init_ret = &field->boot_ret;
9495
ts = iter->ts;
95-
nsec_rem = do_div(ts, 1000000000);
96+
nsec_rem = do_div(ts, NSEC_PER_SEC);
9697

9798
ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s "
9899
"returned %d after %llu msecs\n",

‎kernel/trace/trace_mmiotrace.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <linux/kernel.h>
1010
#include <linux/mmiotrace.h>
1111
#include <linux/pci.h>
12+
#include <linux/time.h>
13+
1214
#include <asm/atomic.h>
1315

1416
#include "trace.h"
@@ -174,7 +176,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
174176
struct mmiotrace_rw *rw;
175177
struct trace_seq *s = &iter->seq;
176178
unsigned long long t = ns2usecs(iter->ts);
177-
unsigned long usec_rem = do_div(t, 1000000ULL);
179+
unsigned long usec_rem = do_div(t, USEC_PER_SEC);
178180
unsigned secs = (unsigned long)t;
179181
int ret = 1;
180182

@@ -221,7 +223,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)
221223
struct mmiotrace_map *m;
222224
struct trace_seq *s = &iter->seq;
223225
unsigned long long t = ns2usecs(iter->ts);
224-
unsigned long usec_rem = do_div(t, 1000000ULL);
226+
unsigned long usec_rem = do_div(t, USEC_PER_SEC);
225227
unsigned secs = (unsigned long)t;
226228
int ret;
227229

0 commit comments

Comments
 (0)