Message ID | 1506010697-22114-5-git-send-email-martyn.welch@collabora.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Sep 21, 2017 at 05:18:15PM +0100, Martyn Welch wrote: > From: Nandor Han <nandor.han@ge.com> > > This commits unmaps sg buffers when the DMA channel is released. It also > sets to zero `dma_is_rxing` and `dma_is_txing` to state that the > corresponding channels cannot transmit/receive data, as these are > disabled. That's a fix for a race, right? The functions being fixed were introduced just in the patch before and I guess the race was there already before. It is best if you could resort your series to have fixes first. This way they can easily be applied during the rc phase while the rest waits for the merge window. Best regards Uwe
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 2fb3210..ed02783 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -357,6 +357,12 @@ static void imx_stop_tx_dma(struct imx_port *sport) temp = readl(sport->port.membase + UCR1); temp &= ~UCR1_TDMAEN; writel(temp, sport->port.membase + UCR1); + + if (sport->dma_is_txing) { + dma_unmap_sg(sport->port.dev, &sport->tx_sgl[0], + sport->dma_tx_nents, DMA_TO_DEVICE); + sport->dma_is_txing = 0; + } } static void imx_stop_rx_dma(struct imx_port *sport) @@ -366,6 +372,12 @@ static void imx_stop_rx_dma(struct imx_port *sport) temp = readl(sport->port.membase + UCR1); temp &= ~(UCR1_RDMAEN | UCR1_ATDMAEN); writel(temp, sport->port.membase + UCR1); + + if (sport->dma_is_rxing) { + dma_unmap_sg(sport->port.dev, &sport->rx_sgl, 1, + DMA_FROM_DEVICE); + sport->dma_is_rxing = 0; + } } /*