diff options
author | Will Newton <will.newton@gmail.com> | 2008-02-05 01:27:50 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:09 -0500 |
commit | 74a197417240120d638d67d74f48655fb7f46f16 (patch) | |
tree | 903eea1331d4fbea110806f7ca4e4a96c128724a /drivers | |
parent | 02c9b5cf9acd8a85313b892dc5196ccf133d4884 (diff) |
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')
-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) | |||
2662 | memset(&port, 0, sizeof(struct uart_port)); | 2662 | memset(&port, 0, sizeof(struct uart_port)); |
2663 | 2663 | ||
2664 | for (i = 0; p && p->flags != 0; p++, i++) { | 2664 | for (i = 0; p && p->flags != 0; p++, i++) { |
2665 | port.iobase = p->iobase; | 2665 | port.iobase = p->iobase; |
2666 | port.membase = p->membase; | 2666 | port.membase = p->membase; |
2667 | port.irq = p->irq; | 2667 | port.irq = p->irq; |
2668 | port.uartclk = p->uartclk; | 2668 | port.uartclk = p->uartclk; |
2669 | port.regshift = p->regshift; | 2669 | port.regshift = p->regshift; |
2670 | port.iotype = p->iotype; | 2670 | port.iotype = p->iotype; |
2671 | port.flags = p->flags; | 2671 | port.flags = p->flags; |
2672 | port.mapbase = p->mapbase; | 2672 | port.mapbase = p->mapbase; |
2673 | port.hub6 = p->hub6; | 2673 | port.hub6 = p->hub6; |
2674 | port.dev = &dev->dev; | 2674 | port.private_data = p->private_data; |
2675 | port.dev = &dev->dev; | ||
2675 | if (share_irqs) | 2676 | if (share_irqs) |
2676 | port.flags |= UPF_SHARE_IRQ; | 2677 | port.flags |= UPF_SHARE_IRQ; |
2677 | ret = serial8250_register_port(&port); | 2678 | ret = serial8250_register_port(&port); |
@@ -2812,15 +2813,16 @@ int serial8250_register_port(struct uart_port *port) | |||
2812 | if (uart) { | 2813 | if (uart) { |
2813 | uart_remove_one_port(&serial8250_reg, &uart->port); | 2814 | uart_remove_one_port(&serial8250_reg, &uart->port); |
2814 | 2815 | ||
2815 | uart->port.iobase = port->iobase; | 2816 | uart->port.iobase = port->iobase; |
2816 | uart->port.membase = port->membase; | 2817 | uart->port.membase = port->membase; |
2817 | uart->port.irq = port->irq; | 2818 | uart->port.irq = port->irq; |
2818 | uart->port.uartclk = port->uartclk; | 2819 | uart->port.uartclk = port->uartclk; |
2819 | uart->port.fifosize = port->fifosize; | 2820 | uart->port.fifosize = port->fifosize; |
2820 | uart->port.regshift = port->regshift; | 2821 | uart->port.regshift = port->regshift; |
2821 | uart->port.iotype = port->iotype; | 2822 | uart->port.iotype = port->iotype; |
2822 | uart->port.flags = port->flags | UPF_BOOT_AUTOCONF; | 2823 | uart->port.flags = port->flags | UPF_BOOT_AUTOCONF; |
2823 | uart->port.mapbase = port->mapbase; | 2824 | uart->port.mapbase = port->mapbase; |
2825 | uart->port.private_data = port->private_data; | ||
2824 | if (port->dev) | 2826 | if (port->dev) |
2825 | uart->port.dev = port->dev; | 2827 | uart->port.dev = port->dev; |
2826 | 2828 | ||