diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2014-10-21 18:23:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-06 17:57:24 -0500 |
commit | e979f3b712c8b8ae44bab591427f1647dd25aa0d (patch) | |
tree | 731b223bffeb14bf3e9eb0dfae412d812e057fdf | |
parent | 1ab8e4b1acdf39ebe6002bbe07ef6e578cff5d74 (diff) |
tty: serial: bcm63xx: Eliminate unnecessary request/release functions
We don't really need to perform the ioremap "on demand" so it's simpler
just to do it from the probe function. This also lets us eliminate the
UART_REG_SIZE constant and rely on the resource information passed in
from the DT or platform code.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/bcm63xx_uart.c | 30 | ||||
-rw-r--r-- | include/linux/serial_bcm63xx.h | 2 |
2 files changed, 10 insertions, 22 deletions
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index 109dea711318..e04e5805ae6e 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -588,20 +588,7 @@ static void bcm_uart_set_termios(struct uart_port *port, | |||
588 | */ | 588 | */ |
589 | static int bcm_uart_request_port(struct uart_port *port) | 589 | static int bcm_uart_request_port(struct uart_port *port) |
590 | { | 590 | { |
591 | unsigned int size; | 591 | /* UARTs always present */ |
592 | |||
593 | size = UART_REG_SIZE; | ||
594 | if (!request_mem_region(port->mapbase, size, "bcm63xx")) { | ||
595 | dev_err(port->dev, "Memory region busy\n"); | ||
596 | return -EBUSY; | ||
597 | } | ||
598 | |||
599 | port->membase = ioremap(port->mapbase, size); | ||
600 | if (!port->membase) { | ||
601 | dev_err(port->dev, "Unable to map registers\n"); | ||
602 | release_mem_region(port->mapbase, size); | ||
603 | return -EBUSY; | ||
604 | } | ||
605 | return 0; | 592 | return 0; |
606 | } | 593 | } |
607 | 594 | ||
@@ -610,8 +597,7 @@ static int bcm_uart_request_port(struct uart_port *port) | |||
610 | */ | 597 | */ |
611 | static void bcm_uart_release_port(struct uart_port *port) | 598 | static void bcm_uart_release_port(struct uart_port *port) |
612 | { | 599 | { |
613 | release_mem_region(port->mapbase, UART_REG_SIZE); | 600 | /* Nothing to release ... */ |
614 | iounmap(port->membase); | ||
615 | } | 601 | } |
616 | 602 | ||
617 | /* | 603 | /* |
@@ -833,13 +819,20 @@ static int bcm_uart_probe(struct platform_device *pdev) | |||
833 | if (pdev->id < 0 || pdev->id >= BCM63XX_NR_UARTS) | 819 | if (pdev->id < 0 || pdev->id >= BCM63XX_NR_UARTS) |
834 | return -EINVAL; | 820 | return -EINVAL; |
835 | 821 | ||
836 | if (ports[pdev->id].membase) | 822 | port = &ports[pdev->id]; |
823 | if (port->membase) | ||
837 | return -EBUSY; | 824 | return -EBUSY; |
825 | memset(port, 0, sizeof(*port)); | ||
838 | 826 | ||
839 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 827 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
840 | if (!res_mem) | 828 | if (!res_mem) |
841 | return -ENODEV; | 829 | return -ENODEV; |
842 | 830 | ||
831 | port->mapbase = res_mem->start; | ||
832 | port->membase = devm_ioremap_resource(&pdev->dev, res_mem); | ||
833 | if (IS_ERR(port->membase)) | ||
834 | return PTR_ERR(port->membase); | ||
835 | |||
843 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 836 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
844 | if (!res_irq) | 837 | if (!res_irq) |
845 | return -ENODEV; | 838 | return -ENODEV; |
@@ -849,10 +842,7 @@ static int bcm_uart_probe(struct platform_device *pdev) | |||
849 | if (IS_ERR(clk)) | 842 | if (IS_ERR(clk)) |
850 | return -ENODEV; | 843 | return -ENODEV; |
851 | 844 | ||
852 | port = &ports[pdev->id]; | ||
853 | memset(port, 0, sizeof(*port)); | ||
854 | port->iotype = UPIO_MEM; | 845 | port->iotype = UPIO_MEM; |
855 | port->mapbase = res_mem->start; | ||
856 | port->irq = res_irq->start; | 846 | port->irq = res_irq->start; |
857 | port->ops = &bcm_uart_ops; | 847 | port->ops = &bcm_uart_ops; |
858 | port->flags = UPF_BOOT_AUTOCONF; | 848 | port->flags = UPF_BOOT_AUTOCONF; |
diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h index a80aa1a5bee2..570e964dc899 100644 --- a/include/linux/serial_bcm63xx.h +++ b/include/linux/serial_bcm63xx.h | |||
@@ -116,6 +116,4 @@ | |||
116 | UART_FIFO_PARERR_MASK | \ | 116 | UART_FIFO_PARERR_MASK | \ |
117 | UART_FIFO_BRKDET_MASK) | 117 | UART_FIFO_BRKDET_MASK) |
118 | 118 | ||
119 | #define UART_REG_SIZE 24 | ||
120 | |||
121 | #endif /* _LINUX_SERIAL_BCM63XX_H */ | 119 | #endif /* _LINUX_SERIAL_BCM63XX_H */ |