summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2018-02-18 22:02:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-02-28 15:29:59 +0100
commit4238c00bb154be840c11540a81c5e99faa06a631 (patch)
tree2db749fed2e7ee6bb7638d3395bda7eac785a79f /drivers/tty
parent437768962f754d9501e5ba4d98b1f2a89dc62028 (diff)
downloadblackbird-op-linux-4238c00bb154be840c11540a81c5e99faa06a631.tar.gz
blackbird-op-linux-4238c00bb154be840c11540a81c5e99faa06a631.zip
serial: imx: simplify tracking of dma being initialized
The .dma_is_inited member is only set to a value != 0 when the port's startup function calls imx_uart_dma_init(). On shutdown of the port imx_uart_dma_exit is called which sets the value back to 0. So .dma_is_inited is always 0 when imx_startup() is called (assuming .startup() and .shutdown() are correctly balanced) and the check for !sport->dma_is_inited can go away. This allows to replace .dma_is_inited by a variable local to imx_startup. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index f34200a4613f..c60ce00e701c 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -205,7 +205,6 @@ struct imx_port {
struct mctrl_gpios *gpios;
/* DMA fields */
- unsigned int dma_is_inited:1;
unsigned int dma_is_enabled:1;
unsigned int dma_is_rxing:1;
unsigned int dma_is_txing:1;
@@ -1114,8 +1113,6 @@ static void imx_uart_dma_exit(struct imx_port *sport)
dma_release_channel(sport->dma_chan_tx);
sport->dma_chan_tx = NULL;
}
-
- sport->dma_is_inited = 0;
}
static int imx_uart_dma_init(struct imx_port *sport)
@@ -1168,8 +1165,6 @@ static int imx_uart_dma_init(struct imx_port *sport)
goto err;
}
- sport->dma_is_inited = 1;
-
return 0;
err:
imx_uart_dma_exit(sport);
@@ -1217,6 +1212,7 @@ static int imx_startup(struct uart_port *port)
struct imx_port *sport = (struct imx_port *)port;
int retval, i;
unsigned long flags, temp;
+ int dma_is_inited = 0;
retval = clk_prepare_enable(sport->clk_per);
if (retval)
@@ -1241,8 +1237,8 @@ static int imx_startup(struct uart_port *port)
writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
/* Can we enable the DMA support? */
- if (!uart_console(port) && !sport->dma_is_inited)
- imx_uart_dma_init(sport);
+ if (!uart_console(port) && imx_uart_dma_init(sport) == 0)
+ dma_is_inited = 1;
spin_lock_irqsave(&sport->port.lock, flags);
/* Reset fifo's and state machines */
@@ -1261,7 +1257,7 @@ static int imx_startup(struct uart_port *port)
writel(USR1_RTSD | USR1_DTRD, sport->port.membase + USR1);
writel(USR2_ORE, sport->port.membase + USR2);
- if (sport->dma_is_inited && !sport->dma_is_enabled)
+ if (dma_is_inited && !sport->dma_is_enabled)
imx_enable_dma(sport);
temp = readl(sport->port.membase + UCR1) & ~UCR1_RRDYEN;
OpenPOWER on IntegriCloud