[PATCH v2 12/45] drivers: tty: serial: xilinx_uartps: use devm_* functions
From: Enrico Weigelt, metux IT consult
Date: Thu Mar 14 2019 - 18:38:36 EST
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@xxxxxxxxx>
---
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