From f284f5467788e4ba28874f6fa6871a03b4b7320f Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 21 Sep 2007 13:27:04 -0700 Subject: [PATCH] --- yaml --- r: 65124 b: refs/heads/master c: 6247cdc2cd334dad0ea5428245a7d8f4b075f21e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/crypto/async_tx/async_tx.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 287a7fb453b9..c6af0108eb1d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c5d2b9f444b8d9f5ad7c5e583686c119ba3a9ba7 +refs/heads/master: 6247cdc2cd334dad0ea5428245a7d8f4b075f21e diff --git a/trunk/crypto/async_tx/async_tx.c b/trunk/crypto/async_tx/async_tx.c index 035007145e78..bc18cbb8ea79 100644 --- a/trunk/crypto/async_tx/async_tx.c +++ b/trunk/crypto/async_tx/async_tx.c @@ -80,6 +80,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) { enum dma_status status; struct dma_async_tx_descriptor *iter; + struct dma_async_tx_descriptor *parent; if (!tx) return DMA_SUCCESS; @@ -87,8 +88,15 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) /* poll through the dependency chain, return when tx is complete */ do { iter = tx; - while (iter->cookie == -EBUSY) - iter = iter->parent; + + /* find the root of the unsubmitted dependency chain */ + while (iter->cookie == -EBUSY) { + parent = iter->parent; + if (parent && parent->cookie == -EBUSY) + iter = iter->parent; + else + break; + } status = dma_sync_wait(iter->chan, iter->cookie); } while (status == DMA_IN_PROGRESS || (iter != tx));