lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 27 Mar 2009 13:21:14 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: kill some magic numbers

On Fri, Mar 27, 2009 at 02:55:44PM +0800, Li Zefan wrote:
> Impact: cleanup
> 
> Use USEC_PER_SEC and NSEC_PER_SEC instead of 1000000 and 1000000000.
> 
> Signed-off-by: Li Zefan <lizf@...fujitsu.com>
> ---
>  kernel/trace/trace_boot.c      |    5 +++--
>  kernel/trace/trace_mmiotrace.c |    6 ++++--
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c
> index 7a30fc4..a29ef23 100644
> --- a/kernel/trace/trace_boot.c
> +++ b/kernel/trace/trace_boot.c
> @@ -9,6 +9,7 @@
>  #include <linux/debugfs.h>
>  #include <linux/ftrace.h>
>  #include <linux/kallsyms.h>
> +#include <linux/time.h>
>  
>  #include "trace.h"
>  #include "trace_output.h"
> @@ -67,7 +68,7 @@ initcall_call_print_line(struct trace_iterator *iter)
>  	trace_assign_type(field, entry);
>  	call = &field->boot_call;
>  	ts = iter->ts;
> -	nsec_rem = do_div(ts, 1000000000);
> +	nsec_rem = do_div(ts, NSEC_PER_SEC);
>  
>  	ret = trace_seq_printf(s, "[%5ld.%09ld] calling  %s @ %i\n",
>  			(unsigned long)ts, nsec_rem, call->func, call->caller);
> @@ -92,7 +93,7 @@ initcall_ret_print_line(struct trace_iterator *iter)
>  	trace_assign_type(field, entry);
>  	init_ret = &field->boot_ret;
>  	ts = iter->ts;
> -	nsec_rem = do_div(ts, 1000000000);
> +	nsec_rem = do_div(ts, NSEC_PER_SEC);
>  
>  	ret = trace_seq_printf(s, "[%5ld.%09ld] initcall %s "
>  			"returned %d after %llu msecs\n",
> diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
> index 8e37fcd..d53b45e 100644
> --- a/kernel/trace/trace_mmiotrace.c
> +++ b/kernel/trace/trace_mmiotrace.c
> @@ -9,6 +9,8 @@
>  #include <linux/kernel.h>
>  #include <linux/mmiotrace.h>
>  #include <linux/pci.h>
> +#include <linux/time.h>
> +
>  #include <asm/atomic.h>
>  
>  #include "trace.h"
> @@ -174,7 +176,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
>  	struct mmiotrace_rw *rw;
>  	struct trace_seq *s	= &iter->seq;
>  	unsigned long long t	= ns2usecs(iter->ts);
> -	unsigned long usec_rem	= do_div(t, 1000000ULL);
> +	unsigned long usec_rem	= do_div(t, USEC_PER_SEC);
>  	unsigned secs		= (unsigned long)t;
>  	int ret = 1;
>  
> @@ -221,7 +223,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)
>  	struct mmiotrace_map *m;
>  	struct trace_seq *s	= &iter->seq;
>  	unsigned long long t	= ns2usecs(iter->ts);
> -	unsigned long usec_rem	= do_div(t, 1000000ULL);
> +	unsigned long usec_rem	= do_div(t, USEC_PER_SEC);
>  	unsigned secs		= (unsigned long)t;
>  	int ret;
>  
> -- 
> 1.5.4.rc3


Thanks!

Acked-by: Frederic Weisbecker <fweisbec@...il.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists