[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1552602855-26086-41-git-send-email-info@metux.net>
Date: Thu, 14 Mar 2019 23:34:10 +0100
From: "Enrico Weigelt, metux IT consult" <info@...ux.net>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...uxfoundation.org, eric@...olt.net,
stefan.wahren@...e.com, f.fainelli@...il.com, rjui@...adcom.com,
sbranden@...adcom.com, bcm-kernel-feedback-list@...adcom.com,
andriy.shevchenko@...ux.intel.com, vz@...ia.com,
matthias.bgg@...il.com, yamada.masahiro@...ionext.com,
tklauser@...tanz.ch, richard.genoud@...il.com,
macro@...ux-mips.org, u.kleine-koenig@...gutronix.de,
kernel@...gutronix.de, slemieux.tyco@...il.com,
andy.gross@...aro.org, david.brown@...aro.org, shawnguo@...nel.org,
s.hauer@...gutronix.de, festevam@...il.com, linux-imx@....com,
baohua@...nel.org, jacmet@...site.dk, linux-serial@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: [PATCH v2 40/45] drivers: tty: serial: mpc52xx_uart: use devm_* functions
Use the safer devm versions of memory mapping functions.
Signed-off-by: Enrico Weigelt, metux IT consult <info@...ux.net>
---
drivers/tty/serial/mpc52xx_uart.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 3a75ee0..3e74e44 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1276,11 +1276,13 @@ static u8 mpc5125_psc_get_mr1(struct uart_port *port)
/* remapped by us ? */
if (port->flags & UPF_IOREMAP) {
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}
- release_mem_region(port->mapbase, sizeof(struct mpc52xx_psc));
+ devm_release_mem_region(port->dev,
+ port->mapbase,
+ sizeof(struct mpc52xx_psc));
}
static int
@@ -1289,13 +1291,14 @@ static u8 mpc5125_psc_get_mr1(struct uart_port *port)
int err;
if (port->flags & UPF_IOREMAP) /* Need to remap ? */
- port->membase = ioremap(port->mapbase,
+ port->membase = devm_ioremap(port->dev, port->mapbase,
sizeof(struct mpc52xx_psc));
if (!port->membase)
return -EINVAL;
- err = request_mem_region(port->mapbase, sizeof(struct mpc52xx_psc),
+ err = devm_request_mem_region(port->mapbase,
+ sizeof(struct mpc52xx_psc),
"mpc52xx_psc_uart") != NULL ? 0 : -EBUSY;
if (err)
@@ -1310,10 +1313,12 @@ static u8 mpc5125_psc_get_mr1(struct uart_port *port)
return 0;
out_mapregion:
- release_mem_region(port->mapbase, sizeof(struct mpc52xx_psc));
+ devm_release_mem_region(port->dev,
+ port->mapbase,
+ sizeof(struct mpc52xx_psc));
out_membase:
if (port->flags & UPF_IOREMAP) {
- iounmap(port->membase);
+ devm_iounmap(port->dev, port->membase);
port->membase = NULL;
}
return err;
@@ -1653,7 +1658,9 @@ static u8 mpc5125_psc_get_mr1(struct uart_port *port)
port->uartclk = uartclk;
port->ops = &mpc52xx_uart_ops;
port->mapbase = res.start;
- port->membase = ioremap(res.start, sizeof(struct mpc52xx_psc));
+ port->membase = devm_ioremap(port->dev,
+ res.start,
+ sizeof(struct mpc52xx_psc));
port->irq = irq_of_parse_and_map(np, 0);
if (port->membase == NULL)
--
1.9.1
Powered by blists - more mailing lists