[PATCH 3/5] KGDB-8250: respect early parameters

From: Jan Kiszka
Date: Tue Jan 29 2008 - 18:46:19 EST


This patch makes sure that the config string passed via "kgdb8250="
takes precedence over any built-time configuration.

Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxx>

---
drivers/serial/8250_kgdb.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)

Index: b/drivers/serial/8250_kgdb.c
===================================================================
--- a/drivers/serial/8250_kgdb.c
+++ b/drivers/serial/8250_kgdb.c
@@ -39,7 +39,9 @@ module_param_string(kgdb8250, config, 25
MODULE_PARM_DESC(kgdb8250,
" kgdb8250=<io or mmio>,<address>,<baud rate>,<irq>\n");
static struct kgdb_io local_kgdb_io_ops;
-#endif /* CONFIG_KGDB_8250_MODULE */
+#else /* !CONFIG_KGDB_8250_MODULE */
+static int params_evaluated;
+#endif /* !CONFIG_KGDB_8250_MODULE */

/* Speed of the UART. */
static int kgdb8250_baud;
@@ -320,16 +322,17 @@ static __init int kgdb_init_io(void)
"kgdb8250=<line #>,<baud rate>\n");
return -EINVAL;
}
-#elif defined(CONFIG_KGDB_SIMPLE_SERIAL)
- kgdb8250_baud = CONFIG_KGDB_BAUDRATE;
-
- /* Setup our pointer to the serial port now. */
- current_port = &kgdb8250_ports[CONFIG_KGDB_PORT_NUM];
-#else
- if (kgdb8250_opt(CONFIG_KGDB_8250_CONF_STRING))
- return -EINVAL;
-#endif
-
+#else /* !CONFIG_KGDB_8250_MODULE */
+ if (!params_evaluated) {
+#ifdef CONFIG_KGDB_SIMPLE_SERIAL
+ kgdb8250_baud = CONFIG_KGDB_BAUDRATE;
+ current_port = &kgdb8250_ports[CONFIG_KGDB_PORT_NUM];
+#else /* !CONFIG_KGDB_SIMPLE_SERIAL */
+ if (kgdb8250_opt(CONFIG_KGDB_8250_CONF_STRING))
+ return -EINVAL;
+#endif /* !CONFIG_KGDB_SIMPLE_SERIAL */
+ }
+#endif /* !CONFIG_KGDB_8250_MODULE */

/* Internal driver setup. */
switch (current_port->iotype) {
@@ -512,7 +515,9 @@ finish:
#ifdef CONFIG_KGDB_SIMPLE_SERIAL
should_copy_rs_table = 0;
#endif
-
+#ifdef CONFIG_KGDB_8250
+ params_evaluated = 1;
+#endif
return 0;

errout:
--
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/