mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-27 17:35:35 +00:00
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>
This commit is contained in:
parent
3a0ab62f43
commit
686351f342
1 changed files with 3 additions and 3 deletions
|
@ -413,7 +413,7 @@ static void imx_stop_tx(struct uart_port *port)
|
||||||
* We are maybe in the SMP context, so if the DMA TX thread is running
|
* We are maybe in the SMP context, so if the DMA TX thread is running
|
||||||
* on other cpu, we have to wait for it to finish.
|
* on other cpu, we have to wait for it to finish.
|
||||||
*/
|
*/
|
||||||
if (sport->dma_is_enabled && sport->dma_is_txing)
|
if (sport->dma_is_txing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
temp = imx_uart_readl(sport, UCR1);
|
temp = imx_uart_readl(sport, UCR1);
|
||||||
|
@ -442,7 +442,7 @@ static void imx_stop_rx(struct uart_port *port)
|
||||||
struct imx_port *sport = (struct imx_port *)port;
|
struct imx_port *sport = (struct imx_port *)port;
|
||||||
unsigned long temp;
|
unsigned long temp;
|
||||||
|
|
||||||
if (sport->dma_is_enabled && sport->dma_is_rxing) {
|
if (sport->dma_is_rxing) {
|
||||||
if (sport->port.suspended) {
|
if (sport->port.suspended) {
|
||||||
dmaengine_terminate_all(sport->dma_chan_rx);
|
dmaengine_terminate_all(sport->dma_chan_rx);
|
||||||
sport->dma_is_rxing = 0;
|
sport->dma_is_rxing = 0;
|
||||||
|
@ -900,7 +900,7 @@ static unsigned int imx_tx_empty(struct uart_port *port)
|
||||||
ret = (imx_uart_readl(sport, USR2) & USR2_TXDC) ? TIOCSER_TEMT : 0;
|
ret = (imx_uart_readl(sport, USR2) & USR2_TXDC) ? TIOCSER_TEMT : 0;
|
||||||
|
|
||||||
/* If the TX DMA is working, return 0. */
|
/* If the TX DMA is working, return 0. */
|
||||||
if (sport->dma_is_enabled && sport->dma_is_txing)
|
if (sport->dma_is_txing)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue