diff mbox

davinci-cpdma: fix locking issue in cpdma_chan_stop

Message ID 1324238524-21330-1-git-send-email-yanok@emcraft.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ilya Yanok Dec. 18, 2011, 8:02 p.m. UTC
Free the channel lock before calling __cpdma_chan_process to prevent
dead lock.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Palande, Ameya Dec. 18, 2011, 11:45 p.m. UTC | #1
Tested-by: Ameya Palande <2ameya@gmail.com>

On Sun, Dec 18, 2011 at 12:02 PM, Ilya Yanok <yanok@emcraft.com> wrote:
> Free the channel lock before calling __cpdma_chan_process to prevent
> dead lock.
>
> Signed-off-by: Ilya Yanok <yanok@emcraft.com>
> ---
>  drivers/net/ethernet/ti/davinci_cpdma.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
> index dca9d33..c97d2f5 100644
> --- a/drivers/net/ethernet/ti/davinci_cpdma.c
> +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
> @@ -836,11 +836,13 @@ int cpdma_chan_stop(struct cpdma_chan *chan)
>        chan_write(chan, cp, CPDMA_TEARDOWN_VALUE);
>
>        /* handle completed packets */
> +       spin_unlock_irqrestore(&chan->lock, flags);
>        do {
>                ret = __cpdma_chan_process(chan);
>                if (ret < 0)
>                        break;
>        } while ((ret & CPDMA_DESC_TD_COMPLETE) == 0);
> +       spin_lock_irqsave(&chan->lock, flags);
>
>        /* remaining packets haven't been tx/rx'ed, clean them up */
>        while (chan->head) {
> --
> 1.7.6.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index dca9d33..c97d2f5 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -836,11 +836,13 @@  int cpdma_chan_stop(struct cpdma_chan *chan)
 	chan_write(chan, cp, CPDMA_TEARDOWN_VALUE);
 
 	/* handle completed packets */
+	spin_unlock_irqrestore(&chan->lock, flags);
 	do {
 		ret = __cpdma_chan_process(chan);
 		if (ret < 0)
 			break;
 	} while ((ret & CPDMA_DESC_TD_COMPLETE) == 0);
+	spin_lock_irqsave(&chan->lock, flags);
 
 	/* remaining packets haven't been tx/rx'ed, clean them up */
 	while (chan->head) {