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 43/45] drivers: tty: serial: pmac_zilog: 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/pmac_zilog.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index bcb5bf7..bce19b0 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -1411,7 +1411,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
if (of_address_to_resource(np, 0, &r_ports))
return -ENODEV;
uap->port.mapbase = r_ports.start;
- uap->port.membase = ioremap(uap->port.mapbase, 0x1000);
+ uap->port.membase = devm_ioremap(uap->port->dev, uap->port.mapbase, 0x1000);

uap->control_reg = uap->port.membase;
uap->data_reg = uap->control_reg + 0x10;
@@ -1428,14 +1428,16 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
memset(&r_rxdma, 0, sizeof(struct resource));
#endif
if (ZS_HAS_DMA(uap)) {
- uap->tx_dma_regs = ioremap(r_txdma.start, 0x100);
+ uap->tx_dma_regs = devm_ioremap(uap->port.dev,
+ r_txdma.start, 0x100);
if (uap->tx_dma_regs == NULL) {
uap->flags &= ~PMACZILOG_FLAG_HAS_DMA;
goto no_dma;
}
- uap->rx_dma_regs = ioremap(r_rxdma.start, 0x100);
+ uap->rx_dma_regs = devm_ioremap(uap->port.dev,
+ r_rxdma.start, 0x100);
if (uap->rx_dma_regs == NULL) {
- iounmap(uap->tx_dma_regs);
+ devm_iounmap(uap->port.dev, uap->tx_dma_regs);
uap->tx_dma_regs = NULL;
uap->flags &= ~PMACZILOG_FLAG_HAS_DMA;
goto no_dma;
@@ -1530,9 +1532,9 @@ static void pmz_dispose_port(struct uart_pmac_port *uap)
struct device_node *np;

np = uap->node;
- iounmap(uap->rx_dma_regs);
- iounmap(uap->tx_dma_regs);
- iounmap(uap->control_reg);
+ devm_iounmap(uap->port.dev, uap->rx_dma_regs);
+ devm_iounmap(uap->port.dev, uap->tx_dma_regs);
+ devm_iounmap(uap->port.dev, uap->control_reg);
uap->node = NULL;
of_node_put(np);
memset(uap, 0, sizeof(struct uart_pmac_port));
--
1.9.1
\
 
 \ /
  Last update: 2019-03-14 23:35    [W:0.126 / U:19.444 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site