diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2017-04-19 22:17:47 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-18 16:36:13 +0200 |
commit | ff3b9cad7d630980987bc46853b2dae75143dc75 (patch) | |
tree | c34198eea7ed455e1c951030d1e23c29a03ca7c0 /drivers/tty/serial/meson_uart.c | |
parent | 5a2ce87bf27579ea359f0caba34f17fd6d0798d5 (diff) | |
download | linux-ff3b9cad7d630980987bc46853b2dae75143dc75.tar.bz2 |
serial: meson: make use of uart_port member mapsize
Member mapsize of struct uart_port is meant to store the resource size.
By using it we can get rid of meson_uart_res_size().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/meson_uart.c')
-rw-r--r-- | drivers/tty/serial/meson_uart.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c index e93a1e47ec6c..1220c9ac8d4b 100644 --- a/drivers/tty/serial/meson_uart.c +++ b/drivers/tty/serial/meson_uart.c @@ -402,26 +402,11 @@ static int meson_uart_verify_port(struct uart_port *port, return ret; } -static int meson_uart_res_size(struct uart_port *port) -{ - struct platform_device *pdev = to_platform_device(port->dev); - struct resource *res; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(port->dev, "cannot obtain I/O memory region"); - return -ENODEV; - } - - return resource_size(res); -} - static void meson_uart_release_port(struct uart_port *port) { - int size = meson_uart_res_size(port); - if (port->flags & UPF_IOREMAP) { - devm_release_mem_region(port->dev, port->mapbase, size); + devm_release_mem_region(port->dev, port->mapbase, + port->mapsize); devm_iounmap(port->dev, port->membase); port->membase = NULL; } @@ -429,12 +414,7 @@ static void meson_uart_release_port(struct uart_port *port) static int meson_uart_request_port(struct uart_port *port) { - int size = meson_uart_res_size(port); - - if (size < 0) - return size; - - if (!devm_request_mem_region(port->dev, port->mapbase, size, + if (!devm_request_mem_region(port->dev, port->mapbase, port->mapsize, dev_name(port->dev))) { dev_err(port->dev, "Memory region busy\n"); return -EBUSY; @@ -443,7 +423,7 @@ static int meson_uart_request_port(struct uart_port *port) if (port->flags & UPF_IOREMAP) { port->membase = devm_ioremap_nocache(port->dev, port->mapbase, - size); + port->mapsize); if (port->membase == NULL) return -ENOMEM; } @@ -641,6 +621,7 @@ static int meson_uart_probe(struct platform_device *pdev) port->uartclk = clk_get_rate(clk); port->iotype = UPIO_MEM; port->mapbase = res_mem->start; + port->mapsize = resource_size(res_mem); port->irq = res_irq->start; port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY; port->dev = &pdev->dev; |