mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] stacktrace: print_stack_trace() cleanup
@ 2008-06-13  9:00 Vegard Nossum
  2008-06-13 11:18 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Vegard Nossum @ 2008-06-13  9:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Arjan van de Ven, Ingo Molnar, linux-kernel

From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Fri, 13 Jun 2008 10:05:26 +0200
Subject: [PATCH] stacktrace: print_stack_trace() cleanup

This admittedly doesn't have too many benefits, these are the two I can
think of: shorter code and better atomicity with regards to printk().

(It's been tested with the backtrace self-test code on i386 and x86_64.)

Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
---
 kernel/stacktrace.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c
index b71816e..2ee264b 100644
--- a/kernel/stacktrace.c
+++ b/kernel/stacktrace.c
@@ -11,14 +11,11 @@
 
 void print_stack_trace(struct stack_trace *trace, int spaces)
 {
-	int i, j;
+	int i;
 
 	for (i = 0; i < trace->nr_entries; i++) {
-		unsigned long ip = trace->entries[i];
-
-		for (j = 0; j < spaces + 1; j++)
-			printk(" ");
-		print_ip_sym(ip);
+		printk("%*c", 1 + spaces, ' ');
+		print_ip_sym(trace->entries[i]);
 	}
 }
 
-- 
1.5.4.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-13 11:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-13  9:00 [PATCH] stacktrace: print_stack_trace() cleanup Vegard Nossum
2008-06-13 11:18 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®