[PATCH] kexec: debug: Use dbgprintf() instead of #ifdef DEBUG

Zhang Yanfei zhangyanfei.yes at gmail.com
Wed Mar 20 09:14:52 EDT 2013


From: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>

When use -d option, dbgprintf() will be used to print the debug info.
And we don't have a DEBUG definition, so replace #ifdef DEBUG test
with dbgprinf().

Signed-off-by: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>
---
 kexec/arch/i386/crashdump-x86.c    |    6 ++----
 kexec/arch/ppc64/crashdump-ppc64.c |   12 +++---------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 5462f8b..31748c2 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -929,10 +929,8 @@ static int cmdline_add_memmap_reserved(char *cmdline, unsigned long start,
 		die("Command line overflow\n");
 	strcat(cmdline, str_mmap);
 
-#ifdef DEBUG
-		printf("Command line after adding reserved memmap\n");
-		printf("%s\n", cmdline);
-#endif
+	dbgprintf("Command line after adding reserved memmap\n");
+	dbgprintf("%s\n", cmdline);
 	return 0;
 }
 
diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
index 49cab12..6b2eb4c 100644
--- a/kexec/arch/ppc64/crashdump-ppc64.c
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
@@ -472,24 +472,18 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size)
 			if (base < ustart && end > uend) {
 				usablemem_rgns.ranges[i].start = base;
 				usablemem_rgns.ranges[i].end = end;
-#ifdef DEBUG
-				fprintf(stderr, "usable memory rgn %u: new base:%llx new size:%llx\n",
+				dbgprintf("usable memory rgn %u: new base:%llx new size:%llx\n",
 					i, base, size);
-#endif
 				return;
 			} else if (base < ustart) {
 				usablemem_rgns.ranges[i].start = base;
-#ifdef DEBUG
-				fprintf(stderr, "usable memory rgn %u: new base:%llx new size:%llx",
+				dbgprintf("usable memory rgn %u: new base:%llx new size:%llx",
 					i, base, usablemem_rgns.ranges[i].end - base);
-#endif
 				return;
 			} else if (end > uend){
 				usablemem_rgns.ranges[i].end = end;
-#ifdef DEBUG
-				fprintf(stderr, "usable memory rgn %u: new end:%llx, new size:%llx",
+				dbgprintf("usable memory rgn %u: new end:%llx, new size:%llx",
 					i, end, end - usablemem_rgns.ranges[i].start);
-#endif
 				return;
 			}
 		}
-- 
1.7.1



More information about the kexec mailing list