[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1552602855-26086-28-git-send-email-info@metux.net>
Date: Thu, 14 Mar 2019 23:33:57 +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 27/45] drivers: tty: serial: dz: 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/dz.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 96e35af..10a75e3 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -666,19 +666,22 @@ static void dz_release_port(struct uart_port *uport)
struct dz_mux *mux = to_dport(uport)->mux;
int map_guard;
- iounmap(uport->membase);
+ devm_iounmap(uport->dev, uport->membase);
uport->membase = NULL;
map_guard = atomic_add_return(-1, &mux->map_guard);
if (!map_guard)
- release_mem_region(uport->mapbase, dec_kn_slot_size);
+ devm_release_mem_region(uport->dev,
+ uport->mapbase,
+ dec_kn_slot_size);
}
static int dz_map_port(struct uart_port *uport)
{
if (!uport->membase)
- uport->membase = ioremap_nocache(uport->mapbase,
- dec_kn_slot_size);
+ uport->membase = devm_ioremap_nocache(uport->dev,
+ uport->mapbase,
+ dec_kn_slot_size);
if (!uport->membase) {
dev_err(uport->dev, "Cannot map MMIO\n");
return -ENOMEM;
@@ -694,8 +697,10 @@ static int dz_request_port(struct uart_port *uport)
map_guard = atomic_add_return(1, &mux->map_guard);
if (map_guard == 1) {
- if (!request_mem_region(uport->mapbase, dec_kn_slot_size,
- "dz")) {
+ if (!devm_request_mem_region(uport->dev,
+ uport->mapbase,
+ dec_kn_slot_size,
+ "dz")) {
atomic_add(-1, &mux->map_guard);
dev_err(uport->dev,
"Unable to reserve MMIO resource\n");
@@ -706,7 +711,9 @@ static int dz_request_port(struct uart_port *uport)
if (ret) {
map_guard = atomic_add_return(-1, &mux->map_guard);
if (!map_guard)
- release_mem_region(uport->mapbase, dec_kn_slot_size);
+ devm_release_mem_region(uport->dev,
+ uport->mapbase,
+ dec_kn_slot_size);
return ret;
}
return 0;
--
1.9.1
Powered by blists - more mailing lists