aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorBen Dooks <ben.dooks@codethink.co.uk>2015-11-18 09:41:11 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-12-13 22:59:48 -0500
commit1bc1f17b7f1ca320b389622e3c7fbf4ee8991f61 (patch)
treeb84bdd60d87a2c6df5de44608fa9b3f8f2babdd8 /drivers/tty
parentf5ce6edd22cff94e7b4a17f26cad43e60ae3d080 (diff)
ARM: meson: serial: release region on port release
The meson_uart_release_port() unmaps the register area but does not release it. The meson_uart_request_port() calls devm_request_mem_region so the release should call devm_release_mem_region() for that area so that anyt subsequent use of these calls will work. This fixes an issue where the addition of reset code before registering the uart stops the console from working. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Tested-by: Carlo Caione <carlo@endlessm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/meson_uart.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 0fc83c962d10..b9f0829ceda1 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -367,9 +367,26 @@ static int meson_uart_verify_port(struct uart_port *port,
367 return ret; 367 return ret;
368} 368}
369 369
370static int meson_uart_res_size(struct uart_port *port)
371{
372 struct platform_device *pdev = to_platform_device(port->dev);
373 struct resource *res;
374
375 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
376 if (!res) {
377 dev_err(port->dev, "cannot obtain I/O memory region");
378 return -ENODEV;
379 }
380
381 return resource_size(res);
382}
383
370static void meson_uart_release_port(struct uart_port *port) 384static void meson_uart_release_port(struct uart_port *port)
371{ 385{
386 int size = meson_uart_res_size(port);
387
372 if (port->flags & UPF_IOREMAP) { 388 if (port->flags & UPF_IOREMAP) {
389 devm_release_mem_region(port->dev, port->mapbase, size);
373 devm_iounmap(port->dev, port->membase); 390 devm_iounmap(port->dev, port->membase);
374 port->membase = NULL; 391 port->membase = NULL;
375 } 392 }
@@ -377,16 +394,10 @@ static void meson_uart_release_port(struct uart_port *port)
377 394
378static int meson_uart_request_port(struct uart_port *port) 395static int meson_uart_request_port(struct uart_port *port)
379{ 396{
380 struct platform_device *pdev = to_platform_device(port->dev); 397 int size = meson_uart_res_size(port);
381 struct resource *res;
382 int size;
383 398
384 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 399 if (size < 0)
385 if (!res) { 400 return size;
386 dev_err(&pdev->dev, "cannot obtain I/O memory region");
387 return -ENODEV;
388 }
389 size = resource_size(res);
390 401
391 if (!devm_request_mem_region(port->dev, port->mapbase, size, 402 if (!devm_request_mem_region(port->dev, port->mapbase, size,
392 dev_name(port->dev))) { 403 dev_name(port->dev))) {