Re: [PATCH] x86: combine printk()s in show_regs_common()

From: Joe Perches
Date: Thu Feb 17 2011 - 13:53:47 EST


On Thu, 2011-02-17 at 15:56 +0000, Jan Beulich wrote:
> Printing a single character alone when there's an immediately following
> printk() is pretty pointless (and wasteful).
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Perhaps better still to use just one printk.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
arch/x86/kernel/process.c | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index ff45541..0f43771 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -103,20 +103,18 @@ void show_regs_common(void)

/* Board Name is optional */
board = dmi_get_system_info(DMI_BOARD_NAME);
+ if (!board)
+ board = "";

printk(KERN_CONT "\n");
- printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s",
- current->pid, current->comm, print_tainted(),
- init_utsname()->release,
- (int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
- printk(KERN_CONT " ");
- printk(KERN_CONT "%s %s", vendor, product);
- if (board) {
- printk(KERN_CONT "/");
- printk(KERN_CONT "%s", board);
- }
- printk(KERN_CONT "\n");
+ printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
+ current->pid, current->comm, print_tainted(),
+ init_utsname()->release,
+ (int)strcspn(init_utsname()->version, " "),
+ init_utsname()->version,
+ vendor, product,
+ strlen(board) ? "/" : "",
+ board);
}

void flush_thread(void)


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