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 12/45] drivers: tty: serial: xilinx_uartps: 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/xilinx_uartps.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 74089f5..6684ed7 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -953,15 +953,21 @@ static int cdns_uart_verify_port(struct uart_port *port,
*/
static int cdns_uart_request_port(struct uart_port *port)
{
- if (!request_mem_region(port->mapbase, CDNS_UART_REGISTER_SPACE,
- CDNS_UART_NAME)) {
+ if (!devm_request_mem_region(port->dev,
+ port->mapbase,
+ CDNS_UART_REGISTER_SPACE,
+ CDNS_UART_NAME)) {
return -ENOMEM;
}

- port->membase = ioremap(port->mapbase, CDNS_UART_REGISTER_SPACE);
+ port->membase = devm_ioremap(port->dev,
+ port->mapbase,
+ CDNS_UART_REGISTER_SPACE);
if (!port->membase) {
dev_err(port->dev, "Unable to map registers\n");
- release_mem_region(port->mapbase, CDNS_UART_REGISTER_SPACE);
+ devm_release_mem_region(port->dev,
+ port->mapbase,
+ CDNS_UART_REGISTER_SPACE);
return -ENOMEM;
}
return 0;
@@ -976,8 +982,10 @@ static int cdns_uart_request_port(struct uart_port *port)
*/
static void cdns_uart_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, CDNS_UART_REGISTER_SPACE);
- iounmap(port->membase);
+ devm_release_mem_region(port->dev,
+ port->mapbase,
+ CDNS_UART_REGISTER_SPACE);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}

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