Skip to contentSkip to conversation

stacktrace: print_stack_trace() cleanup

PATCH Applied Vegard Nossum 2 participants 2 messages Jun 13, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stacktrace: print_stack_trace() cleanup

From: Vegard Nossum <[email protected]>
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 <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 kernel/stacktrace.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
kernel/stacktrace.c +3 -6
index b71816e..2ee264b 100644
@@ -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]);
 	}
 }
 
Signature · 1 line
1.5.4.1
Applied
#1 lore raw
Quoted 10 lines · Vegard Nossum

From: Vegard Nossum <[email protected]>
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.)

applied to tip/core/stacktrace - thanks Vegard. (I have hand-merged it as there were a few stacktrace changes in the stacktrace tree already, queued up for v2.6.27.)

Ingo