x86, boot: Wrap debug printing in a new debug_putstr function
authorJoe Millenbach <jmillenbach@gmail.com>
Fri, 20 Jul 2012 01:04:37 +0000 (18:04 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Sat, 21 Jul 2012 18:07:18 +0000 (11:07 -0700)
Change all instances of if (debug) putstr(...) to a new debug_putstr(...).
This allows a future change to conditionally stub out debug_putstr to save
space.

Signed-off-by: Joe Millenbach <jmillenbach@gmail.com>
Link: http://lkml.kernel.org/r/1342746282-28497-3-git-send-email-jmillenbach@gmail.com
Signed-off-by: Gokul Caushik <caushik1@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/boot/compressed/misc.c

index 8f2355d5858a2b24fd2f42414f5c154407981d20..49c6d5632ef7d17a5b5fb4dbff174f54fefbc6ec 100644 (file)
@@ -223,6 +223,12 @@ void __putstr(int error, const char *s)
        outb(0xff & (pos >> 1), vidport+1);
 }
 
+static void debug_putstr(const char *s)
+{
+       if (debug)
+               putstr(s);
+}
+
 void *memset(void *s, int c, size_t n)
 {
        int i;
@@ -293,8 +299,7 @@ static void parse_elf(void *output)
                return;
        }
 
-       if (debug)
-               putstr("Parsing ELF... ");
+       debug_putstr("Parsing ELF... ");
 
        phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
        if (!phdrs)
@@ -346,8 +351,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
        cols = real_mode->screen_info.orig_video_cols;
 
        console_init();
-       if (debug)
-               putstr("early console in decompress_kernel\n");
+       debug_putstr("early console in decompress_kernel\n");
 
        free_mem_ptr     = heap;        /* Heap */
        free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
@@ -366,11 +370,9 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
                error("Wrong destination address");
 #endif
 
-       if (debug)
-               putstr("\nDecompressing Linux... ");
+       debug_putstr("\nDecompressing Linux... ");
        decompress(input_data, input_len, NULL, NULL, output, NULL, error);
        parse_elf(output);
-       if (debug)
-               putstr("done.\nBooting the kernel.\n");
+       debug_putstr("done.\nBooting the kernel.\n");
        return;
 }