From dba266834b0ed53c3380b4ad84bb59134ab1a604 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Wed, 14 Mar 2012 18:37:04 +1100 Subject: [PATCH] --- yaml --- r: 292535 b: refs/heads/master c: 7d3d897a4697e4ff746e5e82f116b2346ed28150 h: refs/heads/master i: 292533: fb3a03767424e5d268644e2d56f2cedcf99058d3 292531: 4e5496d3654cb9e83a3232a0c45f7aeedef8095c 292527: df41c5b0b8484f7b84f723abfe0b1aa6f70c1c97 v: v3 --- [refs] | 2 +- trunk/drivers/tty/hvc/Kconfig | 4 ++++ trunk/drivers/tty/hvc/hvc_udbg.c | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 8f9c4536e0c1..ea571f4b16db 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ba7a4822b48fbc7afd6b567c18e316a03f46684d +refs/heads/master: 7d3d897a4697e4ff746e5e82f116b2346ed28150 diff --git a/trunk/drivers/tty/hvc/Kconfig b/trunk/drivers/tty/hvc/Kconfig index 8ea7f078b233..48cb8d3d1758 100644 --- a/trunk/drivers/tty/hvc/Kconfig +++ b/trunk/drivers/tty/hvc/Kconfig @@ -71,6 +71,10 @@ config HVC_UDBG depends on PPC && EXPERIMENTAL select HVC_DRIVER default n + help + This is meant to be used during HW bring up or debugging when + no other console mechanism exist but udbg, to get you a quick + console for userspace. Do NOT enable in production kernels. config HVC_DCC bool "ARM JTAG DCC console" diff --git a/trunk/drivers/tty/hvc/hvc_udbg.c b/trunk/drivers/tty/hvc/hvc_udbg.c index b0957e61a7be..2259c6e72f06 100644 --- a/trunk/drivers/tty/hvc/hvc_udbg.c +++ b/trunk/drivers/tty/hvc/hvc_udbg.c @@ -36,7 +36,7 @@ static int hvc_udbg_put(uint32_t vtermno, const char *buf, int count) { int i; - for (i = 0; i < count; i++) + for (i = 0; i < count && udbg_putc; i++) udbg_putc(buf[i]); return i; @@ -67,6 +67,9 @@ static int __init hvc_udbg_init(void) { struct hvc_struct *hp; + if (!udbg_putc) + return -ENODEV; + BUG_ON(hvc_udbg_dev); hp = hvc_alloc(0, NO_IRQ, &hvc_udbg_ops, 16); @@ -88,6 +91,9 @@ module_exit(hvc_udbg_exit); static int __init hvc_udbg_console_init(void) { + if (!udbg_putc) + return -ENODEV; + hvc_instantiate(0, 0, &hvc_udbg_ops); add_preferred_console("hvc", 0, NULL);