return;
        first = 0;
 
+       if (nr_uarts > UART_NR)
+               nr_uarts = UART_NR;
+
        for (i = 0; i < nr_uarts; i++) {
                struct uart_8250_port *up = &serial8250_ports[i];
                struct uart_port *port = &up->port;
 
                init_timer(&up->timer);
                up->timer.function = serial8250_timeout;
+               up->cur_iotype = 0xFF;
 
                /*
                 * ALPHA_KLUDGE_MCR needs to be killed.
 
        for (i = 0; i < nr_uarts; i++) {
                struct uart_8250_port *up = &serial8250_ports[i];
-               up->cur_iotype = 0xFF;
-       }
 
-       serial8250_isa_init_ports();
-
-       for (i = 0; i < nr_uarts; i++) {
-               struct uart_8250_port *up = &serial8250_ports[i];
+               if (up->port.dev)
+                       continue;
 
                up->port.dev = dev;
 
 
 static int __init serial8250_console_init(void)
 {
-       if (nr_uarts > UART_NR)
-               nr_uarts = UART_NR;
-
        serial8250_isa_init_ports();
        register_console(&serial8250_console);
        return 0;
 
        uart = serial8250_find_match_or_unused(&up->port);
        if (uart) {
-               uart_remove_one_port(&serial8250_reg, &uart->port);
+               if (uart->port.dev)
+                       uart_remove_one_port(&serial8250_reg, &uart->port);
 
                uart->port.iobase       = up->port.iobase;
                uart->port.membase      = up->port.membase;
 {
        int ret;
 
-       if (nr_uarts > UART_NR)
-               nr_uarts = UART_NR;
+       serial8250_isa_init_ports();
 
        printk(KERN_INFO "Serial: 8250/16550 driver, "
                "%d ports, IRQ sharing %sabled\n", nr_uarts,
        if (ret)
                goto out;
 
+       ret = serial8250_pnp_init();
+       if (ret)
+               goto unreg_uart_drv;
+
        serial8250_isa_devs = platform_device_alloc("serial8250",
                                                    PLAT8250_DEV_LEGACY);
        if (!serial8250_isa_devs) {
                ret = -ENOMEM;
-               goto unreg_uart_drv;
+               goto unreg_pnp;
        }
 
        ret = platform_device_add(serial8250_isa_devs);
        platform_device_del(serial8250_isa_devs);
 put_dev:
        platform_device_put(serial8250_isa_devs);
+unreg_pnp:
+       serial8250_pnp_exit();
 unreg_uart_drv:
 #ifdef CONFIG_SPARC
        sunserial_unregister_minors(&serial8250_reg, UART_NR);
        platform_driver_unregister(&serial8250_isa_driver);
        platform_device_unregister(isa_dev);
 
+       serial8250_pnp_exit();
+
 #ifdef CONFIG_SPARC
        sunserial_unregister_minors(&serial8250_reg, UART_NR);
 #else
 
 #else
 #define ALPHA_KLUDGE_MCR 0
 #endif
+
+#ifdef CONFIG_SERIAL_8250_PNP
+int serial8250_pnp_init(void);
+void serial8250_pnp_exit(void);
+#else
+static inline int serial8250_pnp_init(void) { return 0; }
+static inline void serial8250_pnp_exit(void) { }
+#endif
+
 
 /*
- *  Probe module for 8250/16550-type ISAPNP serial ports.
+ *  Probe for 8250/16550-type ISAPNP serial ports.
  *
  *  Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
  *
        .id_table       = pnp_dev_table,
 };
 
-static int __init serial8250_pnp_init(void)
+int serial8250_pnp_init(void)
 {
        return pnp_register_driver(&serial_pnp_driver);
 }
 
-static void __exit serial8250_pnp_exit(void)
+void serial8250_pnp_exit(void)
 {
        pnp_unregister_driver(&serial_pnp_driver);
 }
 
-module_init(serial8250_pnp_init);
-module_exit(serial8250_pnp_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Generic 8250/16x50 PnP serial driver");
 
          Most people will say Y or M here, so that they can use serial mice,
          modems and similar devices connecting to the standard serial ports.
 
+config SERIAL_8250_PNP
+       bool "8250/16550 PNP device support" if EXPERT
+       depends on SERIAL_8250 && PNP
+       default y
+       ---help---
+         This builds standard PNP serial support. You may be able to
+         disable this feature if you only need legacy serial support.
+
 config SERIAL_8250_CONSOLE
        bool "Console on 8250/16550 and compatible serial port"
        depends on SERIAL_8250=y
          disable this feature if you only need legacy serial support.
          Saves about 9K.
 
-config SERIAL_8250_PNP
-       tristate "8250/16550 PNP device support" if EXPERT
-       depends on SERIAL_8250 && PNP
-       default SERIAL_8250
-       help
-         This builds standard PNP serial support. You may be able to
-         disable this feature if you only need legacy serial support.
-
 config SERIAL_8250_HP300
        tristate
        depends on SERIAL_8250 && HP300
 
 # Makefile for the 8250 serial device drivers.
 #
 
-obj-$(CONFIG_SERIAL_8250)              += 8250.o
-obj-$(CONFIG_SERIAL_8250_PNP)          += 8250_pnp.o
+obj-$(CONFIG_SERIAL_8250)              += 8250_core.o
+8250_core-y                            := 8250.o
+8250_core-$(CONFIG_SERIAL_8250_PNP)    += 8250_pnp.o
 obj-$(CONFIG_SERIAL_8250_GSC)          += 8250_gsc.o
 obj-$(CONFIG_SERIAL_8250_PCI)          += 8250_pci.o
 obj-$(CONFIG_SERIAL_8250_HP300)                += 8250_hp300.o