[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1556369542-13247-10-git-send-email-info@metux.net>
Date: Sat, 27 Apr 2019 14:51:50 +0200
From: "Enrico Weigelt, metux IT consult" <info@...ux.net>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...uxfoundation.org, andrew@...id.au,
andriy.shevchenko@...ux.intel.com, macro@...ux-mips.org,
vz@...ia.com, slemieux.tyco@...il.com, khilman@...libre.com,
liviu.dudau@....com, sudeep.holla@....com,
lorenzo.pieralisi@....com, davem@...emloft.net, jacmet@...site.dk,
linux@...sktech.co.nz, matthias.bgg@...il.com,
linux-mips@...r.kernel.org, linux-serial@...r.kernel.org,
linux-ia64@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, sparclinux@...r.kernel.org
Subject: [PATCH 09/41] drivers: tty: serial: sb1250-duart: fill mapsize and use it
Fill the struct uart_port->mapsize field and use it, insteaf of
hardcoded values in many places. This makes the code layout a bit
more consistent and easily allows using generic helpers for the
io memory handling.
Candidates for such helpers could be eg. the request+ioremap and
iounmap+release combinations.
Signed-off-by: Enrico Weigelt <info@...ux.net>
---
drivers/tty/serial/sb1250-duart.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index 227af87..1184226 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -658,7 +658,7 @@ static void sbd_release_port(struct uart_port *uport)
if(refcount_dec_and_test(&duart->map_guard))
release_mem_region(duart->mapctrl, DUART_CHANREG_SPACING);
- release_mem_region(uport->mapbase, DUART_CHANREG_SPACING);
+ release_mem_region(uport->mapbase, uport->mapsize);
}
static int sbd_map_port(struct uart_port *uport)
@@ -668,7 +668,7 @@ static int sbd_map_port(struct uart_port *uport)
if (!uport->membase)
uport->membase = ioremap_nocache(uport->mapbase,
- DUART_CHANREG_SPACING);
+ uport->mapsize);
if (!uport->membase) {
dev_err(uport->dev, "Cannot map MMIO (base)\n");
return -ENOMEM;
@@ -693,7 +693,7 @@ static int sbd_request_port(struct uart_port *uport)
struct sbd_duart *duart = to_sport(uport)->duart;
int ret = 0;
- if (!request_mem_region(uport->mapbase, DUART_CHANREG_SPACING,
+ if (!request_mem_region(uport->mapbase, uport->mapsize,
"sb1250-duart")) {
pr_err(err);
return -EBUSY;
@@ -716,7 +716,7 @@ static int sbd_request_port(struct uart_port *uport)
}
}
if (ret) {
- release_mem_region(uport->mapbase, DUART_CHANREG_SPACING);
+ release_mem_region(uport->mapbase, uport->mapsize);
return ret;
}
return 0;
@@ -812,6 +812,7 @@ static void __init sbd_probe_duarts(void)
uport->ops = &sbd_ops;
uport->line = line;
uport->mapbase = SBD_CHANREGS(line);
+ uport->mapsize = DUART_CHANREG_SPACING;
}
}
}
--
1.9.1
Powered by blists - more mailing lists