lkml.org 
[lkml]   [2019]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 29/45] drivers: tty: serial: serial_txx9: use devm_* functions
Date
Use the safer devm versions of memory mapping functions.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
drivers/tty/serial/serial_txx9.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index 1b4008d..aa01349 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -757,15 +757,22 @@ static int serial_txx9_request_resource(struct uart_txx9_port *up)
if (!up->port.mapbase)
break;

- if (!request_mem_region(up->port.mapbase, size, "serial_txx9")) {
+ if (!devm_request_mem_region(up->port.dev,
+ up->port.mapbase,
+ size,
+ "serial_txx9")) {
ret = -EBUSY;
break;
}

if (up->port.flags & UPF_IOREMAP) {
- up->port.membase = ioremap(up->port.mapbase, size);
+ up->port.membase = devm_ioremap(up->port.dev,
+ up->port.mapbase,
+ size);
if (!up->port.membase) {
- release_mem_region(up->port.mapbase, size);
+ devm_release_mem_region(up->port.dev,
+ up->port.mapbase,
+ size);
ret = -ENOMEM;
}
}
@@ -789,11 +796,11 @@ static void serial_txx9_release_resource(struct uart_txx9_port *up)
break;

if (up->port.flags & UPF_IOREMAP) {
- iounmap(up->port.membase);
+ devm_iounmap(up->port.dev, up->port.membase);
up->port.membase = NULL;
}

- release_mem_region(up->port.mapbase, size);
+ devm_release_mem_region(up->port.dev, up->port.mapbase, size);
break;

case UPIO_PORT:
--
1.9.1
\
 
 \ /
  Last update: 2019-03-14 23:37    [W:0.120 / U:7.228 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site