diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2018-03-02 05:07:21 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-09 13:21:01 -0500 |
commit | 686351f342fa745d10ddef08d0e930cf53b0c673 (patch) | |
tree | e5684acf2eb9411d4b7d529d5a9a083da6cc2f89 | |
parent | 3a0ab62f43de5c6ec55fb9d6721168602008142a (diff) |
serial: imx: simplify some conditions related to dma
Neither .dma_is_txing nor .dma_is_rxing can evaluate to true if
.dma_is_enabled evaluates to false:
The only function that sets .dma_is_txing to a non-zero value is
imx_dma_tx() which is only called if .dma_is_enabled is true. Same for
.dma_is_rxing and start_rx_dma(). And before .dma_is_enabled is set to 0
when imx_shutdown calls imx_disable_dma(), .dma_is_rxing and
.dma_is_txing are reset to zero before, too.
For this reason
sport->dma_is_enabled && sport->dma_is_rxing
has the same value as
sport->dma_is_rxing
which allows to simplify three if conditions.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/imx.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 57891d21f20d..b87e04334342 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -413,7 +413,7 @@ static void imx_stop_tx(struct uart_port *port) | |||
413 | * We are maybe in the SMP context, so if the DMA TX thread is running | 413 | * We are maybe in the SMP context, so if the DMA TX thread is running |
414 | * on other cpu, we have to wait for it to finish. | 414 | * on other cpu, we have to wait for it to finish. |
415 | */ | 415 | */ |
416 | if (sport->dma_is_enabled && sport->dma_is_txing) | 416 | if (sport->dma_is_txing) |
417 | return; | 417 | return; |
418 | 418 | ||
419 | temp = imx_uart_readl(sport, UCR1); | 419 | temp = imx_uart_readl(sport, UCR1); |
@@ -442,7 +442,7 @@ static void imx_stop_rx(struct uart_port *port) | |||
442 | struct imx_port *sport = (struct imx_port *)port; | 442 | struct imx_port *sport = (struct imx_port *)port; |
443 | unsigned long temp; | 443 | unsigned long temp; |
444 | 444 | ||
445 | if (sport->dma_is_enabled && sport->dma_is_rxing) { | 445 | if (sport->dma_is_rxing) { |
446 | if (sport->port.suspended) { | 446 | if (sport->port.suspended) { |
447 | dmaengine_terminate_all(sport->dma_chan_rx); | 447 | dmaengine_terminate_all(sport->dma_chan_rx); |
448 | sport->dma_is_rxing = 0; | 448 | sport->dma_is_rxing = 0; |
@@ -900,7 +900,7 @@ static unsigned int imx_tx_empty(struct uart_port *port) | |||
900 | ret = (imx_uart_readl(sport, USR2) & USR2_TXDC) ? TIOCSER_TEMT : 0; | 900 | ret = (imx_uart_readl(sport, USR2) & USR2_TXDC) ? TIOCSER_TEMT : 0; |
901 | 901 | ||
902 | /* If the TX DMA is working, return 0. */ | 902 | /* If the TX DMA is working, return 0. */ |
903 | if (sport->dma_is_enabled && sport->dma_is_txing) | 903 | if (sport->dma_is_txing) |
904 | ret = 0; | 904 | ret = 0; |
905 | 905 | ||
906 | return ret; | 906 | return ret; |