--- a/arch/mips/ath79/dev-common.c +++ b/arch/mips/ath79/dev-common.c @@ -67,6 +67,8 @@ static struct plat_serial8250_port ath79 .flags = AR71XX_UART_FLAGS, .iotype = UPIO_MEM32, .regshift = 2, + .platform_probe = &ath79_enable_uart, + .platform_remove = &ath79_disable_uart, }, { /* terminating entry */ } --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -3676,6 +3676,9 @@ static int serial8250_probe(struct platf struct uart_8250_port uart; int ret, i, irqflag = 0; + if (p && p->platform_probe) + p->platform_probe(dev); + memset(&uart, 0, sizeof(uart)); if (share_irqs) @@ -3718,6 +3721,7 @@ static int serial8250_probe(struct platf */ static int serial8250_remove(struct platform_device *dev) { + struct plat_serial8250_port *p; int i; for (i = 0; i < nr_uarts; i++) { @@ -3726,6 +3730,12 @@ static int serial8250_remove(struct plat if (up->port.dev == &dev->dev) serial8250_unregister_port(i); } + + p = dev_get_platdata(&dev->dev); + + if (p && p->platform_remove) + p->platform_remove(dev); + return 0; } --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -39,6 +39,8 @@ struct plat_serial8250_port { void (*pm)(struct uart_port *, unsigned int state, unsigned old); void (*handle_break)(struct uart_port *); + void (*platform_probe)(struct platform_device*); + void (*platform_remove)(struct platform_device*); }; /*