From 131f5a25d07af93accd59effe75e7a566b405ac6 Mon Sep 17 00:00:00 2001 From: Milton Miller Date: Thu, 7 Jul 2005 17:56:24 -0700 Subject: [PATCH] --- yaml --- r: 4230 b: refs/heads/master c: d5ee257c3342185ba8ab642d125d192eb99ea8f2 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/ppc64/kernel/hvconsole.c | 3 ++- trunk/drivers/char/hvc_console.c | 24 ++++++++++++++++++++++-- trunk/include/asm-ppc64/hvconsole.h | 5 +---- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index d2abbf4328d1..6a380d8c0826 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7805b1b29ffdd252dfef36aa28d7bda70cd586d3 +refs/heads/master: d5ee257c3342185ba8ab642d125d192eb99ea8f2 diff --git a/trunk/arch/ppc64/kernel/hvconsole.c b/trunk/arch/ppc64/kernel/hvconsole.c index c72fb8ffe974..94fb06198ea2 100644 --- a/trunk/arch/ppc64/kernel/hvconsole.c +++ b/trunk/arch/ppc64/kernel/hvconsole.c @@ -93,7 +93,7 @@ EXPORT_SYMBOL(hvc_put_chars); * We hope/assume that the first vty found corresponds to the first console * device. */ -int hvc_find_vtys(void) +static int hvc_find_vtys(void) { struct device_node *vty; int num_found = 0; @@ -119,3 +119,4 @@ int hvc_find_vtys(void) return num_found; } +console_initcall(hvc_find_vtys); diff --git a/trunk/drivers/char/hvc_console.c b/trunk/drivers/char/hvc_console.c index 7bc65a76dfc4..d59c642f9654 100644 --- a/trunk/drivers/char/hvc_console.c +++ b/trunk/drivers/char/hvc_console.c @@ -219,10 +219,23 @@ struct console hvc_con_driver = { .index = -1, }; -/* Early console initialization. Preceeds driver initialization. */ +/* + * Early console initialization. Preceeds driver initialization. + * + * (1) we are first, and the user specified another driver + * -- index will remain -1 + * (2) we are first and the user specified no driver + * -- index will be set to 0, then we will fail setup. + * (3) we are first and the user specified our driver + * -- index will be set to user specified driver, and we will fail + * (4) we are after driver, and this initcall will register us + * -- if the user didn't specify a driver then the console will match + * + * Note that for cases 2 and 3, we will match later when the io driver + * calls hvc_instantiate() and call register again. + */ static int __init hvc_console_init(void) { - hvc_find_vtys(); register_console(&hvc_con_driver); return 0; } @@ -257,6 +270,13 @@ int hvc_instantiate(uint32_t vtermno, int index) if (last_hvc < index) last_hvc = index; + /* if this index is what the user requested, then register + * now (setup won't fail at this point). It's ok to just + * call register again if previously .setup failed. + */ + if (index == hvc_con_driver.index) + register_console(&hvc_con_driver); + return 0; } diff --git a/trunk/include/asm-ppc64/hvconsole.h b/trunk/include/asm-ppc64/hvconsole.h index d89d94c91815..91c2414ac00b 100644 --- a/trunk/include/asm-ppc64/hvconsole.h +++ b/trunk/include/asm-ppc64/hvconsole.h @@ -32,9 +32,6 @@ extern int hvc_get_chars(uint32_t vtermno, char *buf, int count); extern int hvc_put_chars(uint32_t vtermno, const char *buf, int count); -/* Early discovery of console adapters. */ -extern int hvc_find_vtys(void); - -/* Implemented by a console driver */ +/* Register a vterm and a slot index for use as a console */ extern int hvc_instantiate(uint32_t vtermno, int index); #endif /* _PPC64_HVCONSOLE_H */