From: Andrew Morton <akpm@osdl.org>

Signed-off-by: Andrew Morton <akpm@osdl.org>
Index: linux-2.6.18-rc6/drivers/serial/8250_kgdb.c
===================================================================
--- linux-2.6.18-rc6.orig/drivers/serial/8250_kgdb.c	2006-09-14 15:46:48.000000000 +0100
+++ linux-2.6.18-rc6/drivers/serial/8250_kgdb.c	2006-09-14 15:46:50.000000000 +0100
@@ -24,6 +24,7 @@
 #include <linux/serial_reg.h>
 #include <linux/serialP.h>
 #include <linux/ioport.h>
+#include <linux/module.h>
 
 #include <asm/io.h>
 #include <asm/serial.h>		/* For BASE_BAUD and SERIAL_PORT_DFNS */
@@ -286,7 +287,8 @@ static void __init kgdb8250_late_init(vo
 	/* Try and copy the old_rs_table. */
 	kgdb8250_copy_rs_table();
 
-#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
+#if defined(CONFIG_SERIAL_8250) || \
+		(defined(MODULE) && defined(CONFIG_SERIAL_8250_MODULE))
 	/* Take the port away from the main driver. */
 	serial8250_unregister_by_port(current_port);
 
@@ -401,6 +403,7 @@ void __init kgdb8250_add_port(int i, str
 	if (current_port != &kgdb8250_ports[i])
                 memcpy(&kgdb8250_ports[i], serial_req, sizeof(struct uart_port));
 }
+EXPORT_SYMBOL(kgdb8250_add_port);
 
 /**
  * 	kgdb8250_add_platform_port - Define a serial port for use with KGDB