diff options
author | Will Newton <will.newton@gmail.com> | 2008-02-04 22:27:50 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 09:44:09 -0800 |
commit | 74a197417240120d638d67d74f48655fb7f46f16 (patch) | |
tree | 903eea1331d4fbea110806f7ca4e4a96c128724a /drivers/serial | |
parent | 02c9b5cf9acd8a85313b892dc5196ccf133d4884 (diff) | |
download | linux-74a197417240120d638d67d74f48655fb7f46f16.tar.bz2 |
8250.c: support specifying DW APB UARTs in device platform_data
Allow the private_data field to be specified in platform_data for the
standard 8250/16550 UART. This field is used by DW APB type UARTs and
without this patch it's only possible to set this field when registering
the port by hand. If private_data is not set then the driver will
potentially oops with a NULL pointer dereference.
Signed-off-by: Will Newton <will.newton@gmail.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/8250.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index f94109cbb46e..c93ef205aa2f 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -2662,16 +2662,17 @@ static int __devinit serial8250_probe(struct platform_device *dev) memset(&port, 0, sizeof(struct uart_port)); for (i = 0; p && p->flags != 0; p++, i++) { - port.iobase = p->iobase; - port.membase = p->membase; - port.irq = p->irq; - port.uartclk = p->uartclk; - port.regshift = p->regshift; - port.iotype = p->iotype; - port.flags = p->flags; - port.mapbase = p->mapbase; - port.hub6 = p->hub6; - port.dev = &dev->dev; + port.iobase = p->iobase; + port.membase = p->membase; + port.irq = p->irq; + port.uartclk = p->uartclk; + port.regshift = p->regshift; + port.iotype = p->iotype; + port.flags = p->flags; + port.mapbase = p->mapbase; + port.hub6 = p->hub6; + port.private_data = p->private_data; + port.dev = &dev->dev; if (share_irqs) port.flags |= UPF_SHARE_IRQ; ret = serial8250_register_port(&port); @@ -2812,15 +2813,16 @@ int serial8250_register_port(struct uart_port *port) if (uart) { uart_remove_one_port(&serial8250_reg, &uart->port); - uart->port.iobase = port->iobase; - uart->port.membase = port->membase; - uart->port.irq = port->irq; - uart->port.uartclk = port->uartclk; - uart->port.fifosize = port->fifosize; - uart->port.regshift = port->regshift; - uart->port.iotype = port->iotype; - uart->port.flags = port->flags | UPF_BOOT_AUTOCONF; - uart->port.mapbase = port->mapbase; + uart->port.iobase = port->iobase; + uart->port.membase = port->membase; + uart->port.irq = port->irq; + uart->port.uartclk = port->uartclk; + uart->port.fifosize = port->fifosize; + uart->port.regshift = port->regshift; + uart->port.iotype = port->iotype; + uart->port.flags = port->flags | UPF_BOOT_AUTOCONF; + uart->port.mapbase = port->mapbase; + uart->port.private_data = port->private_data; if (port->dev) uart->port.dev = port->dev; |