Commit 835d844d authored by Sean Young's avatar Sean Young Committed by Greg Kroah-Hartman

8250_pnp: do pnp probe before legacy probe

We first probe the legacy serial ports and then check pnp. If there
is a non-standard configuration then this might not work, also this
change is needed so we can blacklist Winbond CIR based on PNP ID.

For this to work the 8250_pnp driver must be merged into the 8250
module.
Signed-off-by: default avatarSean Young <sean@mess.org>
Acked-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4dac2116
...@@ -2675,6 +2675,9 @@ static void __init serial8250_isa_init_ports(void) ...@@ -2675,6 +2675,9 @@ static void __init serial8250_isa_init_ports(void)
return; return;
first = 0; first = 0;
if (nr_uarts > UART_NR)
nr_uarts = UART_NR;
for (i = 0; i < nr_uarts; i++) { for (i = 0; i < nr_uarts; i++) {
struct uart_8250_port *up = &serial8250_ports[i]; struct uart_8250_port *up = &serial8250_ports[i];
struct uart_port *port = &up->port; struct uart_port *port = &up->port;
...@@ -2684,6 +2687,7 @@ static void __init serial8250_isa_init_ports(void) ...@@ -2684,6 +2687,7 @@ static void __init serial8250_isa_init_ports(void)
init_timer(&up->timer); init_timer(&up->timer);
up->timer.function = serial8250_timeout; up->timer.function = serial8250_timeout;
up->cur_iotype = 0xFF;
/* /*
* ALPHA_KLUDGE_MCR needs to be killed. * ALPHA_KLUDGE_MCR needs to be killed.
...@@ -2735,13 +2739,9 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev) ...@@ -2735,13 +2739,9 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
for (i = 0; i < nr_uarts; i++) { for (i = 0; i < nr_uarts; i++) {
struct uart_8250_port *up = &serial8250_ports[i]; struct uart_8250_port *up = &serial8250_ports[i];
up->cur_iotype = 0xFF;
}
serial8250_isa_init_ports(); if (up->port.dev)
continue;
for (i = 0; i < nr_uarts; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
up->port.dev = dev; up->port.dev = dev;
...@@ -2866,9 +2866,6 @@ static struct console serial8250_console = { ...@@ -2866,9 +2866,6 @@ static struct console serial8250_console = {
static int __init serial8250_console_init(void) static int __init serial8250_console_init(void)
{ {
if (nr_uarts > UART_NR)
nr_uarts = UART_NR;
serial8250_isa_init_ports(); serial8250_isa_init_ports();
register_console(&serial8250_console); register_console(&serial8250_console);
return 0; return 0;
...@@ -3151,7 +3148,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up) ...@@ -3151,7 +3148,8 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
uart = serial8250_find_match_or_unused(&up->port); uart = serial8250_find_match_or_unused(&up->port);
if (uart) { 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.iobase = up->port.iobase;
uart->port.membase = up->port.membase; uart->port.membase = up->port.membase;
...@@ -3235,8 +3233,7 @@ static int __init serial8250_init(void) ...@@ -3235,8 +3233,7 @@ static int __init serial8250_init(void)
{ {
int ret; int ret;
if (nr_uarts > UART_NR) serial8250_isa_init_ports();
nr_uarts = UART_NR;
printk(KERN_INFO "Serial: 8250/16550 driver, " printk(KERN_INFO "Serial: 8250/16550 driver, "
"%d ports, IRQ sharing %sabled\n", nr_uarts, "%d ports, IRQ sharing %sabled\n", nr_uarts,
...@@ -3251,11 +3248,15 @@ static int __init serial8250_init(void) ...@@ -3251,11 +3248,15 @@ static int __init serial8250_init(void)
if (ret) if (ret)
goto out; goto out;
ret = serial8250_pnp_init();
if (ret)
goto unreg_uart_drv;
serial8250_isa_devs = platform_device_alloc("serial8250", serial8250_isa_devs = platform_device_alloc("serial8250",
PLAT8250_DEV_LEGACY); PLAT8250_DEV_LEGACY);
if (!serial8250_isa_devs) { if (!serial8250_isa_devs) {
ret = -ENOMEM; ret = -ENOMEM;
goto unreg_uart_drv; goto unreg_pnp;
} }
ret = platform_device_add(serial8250_isa_devs); ret = platform_device_add(serial8250_isa_devs);
...@@ -3271,6 +3272,8 @@ static int __init serial8250_init(void) ...@@ -3271,6 +3272,8 @@ static int __init serial8250_init(void)
platform_device_del(serial8250_isa_devs); platform_device_del(serial8250_isa_devs);
put_dev: put_dev:
platform_device_put(serial8250_isa_devs); platform_device_put(serial8250_isa_devs);
unreg_pnp:
serial8250_pnp_exit();
unreg_uart_drv: unreg_uart_drv:
#ifdef CONFIG_SPARC #ifdef CONFIG_SPARC
sunserial_unregister_minors(&serial8250_reg, UART_NR); sunserial_unregister_minors(&serial8250_reg, UART_NR);
...@@ -3295,6 +3298,8 @@ static void __exit serial8250_exit(void) ...@@ -3295,6 +3298,8 @@ static void __exit serial8250_exit(void)
platform_driver_unregister(&serial8250_isa_driver); platform_driver_unregister(&serial8250_isa_driver);
platform_device_unregister(isa_dev); platform_device_unregister(isa_dev);
serial8250_pnp_exit();
#ifdef CONFIG_SPARC #ifdef CONFIG_SPARC
sunserial_unregister_minors(&serial8250_reg, UART_NR); sunserial_unregister_minors(&serial8250_reg, UART_NR);
#else #else
......
...@@ -97,3 +97,12 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value) ...@@ -97,3 +97,12 @@ static inline void serial_dl_write(struct uart_8250_port *up, int value)
#else #else
#define ALPHA_KLUDGE_MCR 0 #define ALPHA_KLUDGE_MCR 0
#endif #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. * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
* *
...@@ -507,18 +507,13 @@ static struct pnp_driver serial_pnp_driver = { ...@@ -507,18 +507,13 @@ static struct pnp_driver serial_pnp_driver = {
.id_table = pnp_dev_table, .id_table = pnp_dev_table,
}; };
static int __init serial8250_pnp_init(void) int serial8250_pnp_init(void)
{ {
return pnp_register_driver(&serial_pnp_driver); 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); 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");
...@@ -33,6 +33,14 @@ config SERIAL_8250 ...@@ -33,6 +33,14 @@ config SERIAL_8250
Most people will say Y or M here, so that they can use serial mice, 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. 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 config SERIAL_8250_CONSOLE
bool "Console on 8250/16550 and compatible serial port" bool "Console on 8250/16550 and compatible serial port"
depends on SERIAL_8250=y depends on SERIAL_8250=y
...@@ -85,14 +93,6 @@ config SERIAL_8250_PCI ...@@ -85,14 +93,6 @@ config SERIAL_8250_PCI
disable this feature if you only need legacy serial support. disable this feature if you only need legacy serial support.
Saves about 9K. 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 config SERIAL_8250_HP300
tristate tristate
depends on SERIAL_8250 && HP300 depends on SERIAL_8250 && HP300
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
# Makefile for the 8250 serial device drivers. # Makefile for the 8250 serial device drivers.
# #
obj-$(CONFIG_SERIAL_8250) += 8250.o obj-$(CONFIG_SERIAL_8250) += 8250_core.o
obj-$(CONFIG_SERIAL_8250_PNP) += 8250_pnp.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_GSC) += 8250_gsc.o
obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o obj-$(CONFIG_SERIAL_8250_PCI) += 8250_pci.o
obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o obj-$(CONFIG_SERIAL_8250_HP300) += 8250_hp300.o
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment