diff options
author | Sascha Hauer <sascha@saschahauer.de> | 2008-04-17 08:47:32 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-17 16:22:21 +0100 |
commit | 3d454446e2b83b4e1e2997b2c6e689c85ab61868 (patch) | |
tree | c56034720494798fd181ab8670259062172ff350 /drivers/serial/imx.c | |
parent | 789d52589a0849004ced991549a61dd110dfeb10 (diff) | |
download | lwn-3d454446e2b83b4e1e2997b2c6e689c85ab61868.tar.gz lwn-3d454446e2b83b4e1e2997b2c6e689c85ab61868.zip |
[ARM] 4998/1: <IMX UART>: do not use hardcoded io space size
Do not use hardcoded io space size. Instead use the information provided
by the resource.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/imx.c')
-rw-r--r-- | drivers/serial/imx.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index dd1e071834be..0ce2b4a45e6d 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c @@ -167,11 +167,6 @@ #define MINOR_START 41 /* - * This is the size of our serial port register set. - */ -#define UART_PORT_SIZE 0x100 - -/* * This determines how often we check the modem status signals * for any change. They generally aren't connected to an IRQ * so we have to poll them. We also check immediately before @@ -721,9 +716,11 @@ static const char *imx_type(struct uart_port *port) */ static void imx_release_port(struct uart_port *port) { - struct imx_port *sport = (struct imx_port *)port; + struct platform_device *pdev = to_platform_device(port->dev); + struct resource *mmres; - release_mem_region(sport->port.mapbase, UART_PORT_SIZE); + mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); + release_mem_region(mmres->start, mmres->end - mmres->start + 1); } /* @@ -731,10 +728,18 @@ static void imx_release_port(struct uart_port *port) */ static int imx_request_port(struct uart_port *port) { - struct imx_port *sport = (struct imx_port *)port; + struct platform_device *pdev = to_platform_device(port->dev); + struct resource *mmres; + void *ret; + + mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mmres) + return -ENODEV; + + ret = request_mem_region(mmres->start, mmres->end - mmres->start + 1, + "imx-uart"); - return request_mem_region(sport->port.mapbase, UART_PORT_SIZE, - "imx-uart") != NULL ? 0 : -EBUSY; + return ret ? 0 : -EBUSY; } /* |