ARM: tegra: dma: Do not call complete callback on canceled requests
authorColin Cross <ccross@android.com>
Wed, 16 Mar 2011 23:53:24 +0000 (16:53 -0700)
committerColin Cross <ccross@android.com>
Tue, 22 Mar 2011 18:25:25 +0000 (11:25 -0700)
Calling the complete callback when a request is cancelled leads to
locking problems in the callback, which could be called from an IRQ
with no locks held, or from whatever context called
tegra_dma_dequeue_req.  Instead, expect the caller to handle the
now-cancelled request as needed.

Also removes tegra_dma_dequeue, since all users can be trivially
converted to tegra_dma_dequeue_req.

Change-Id: If699239c09c78d1cd3afa0eaad46535b1d401a24
Signed-off-by: Colin Cross <ccross@android.com>
arch/arm/mach-tegra/dma.c
arch/arm/mach-tegra/include/mach/dma.h

index db94fcf58399cf7712499b243bf5fef9c47b9673..44f70a9cde7a9a5c4f2085f2b6abf6a382615f72 100644 (file)
@@ -135,24 +135,6 @@ static void tegra_dma_update_hw_partial(struct tegra_dma_channel *ch,
        struct tegra_dma_req *req);
 static void tegra_dma_stop(struct tegra_dma_channel *ch);
 
-void tegra_dma_flush(struct tegra_dma_channel *ch)
-{
-}
-EXPORT_SYMBOL(tegra_dma_flush);
-
-void tegra_dma_dequeue(struct tegra_dma_channel *ch)
-{
-       struct tegra_dma_req *req;
-
-       if (tegra_dma_is_empty(ch))
-               return;
-
-       req = list_entry(ch->list.next, typeof(*req), node);
-
-       tegra_dma_dequeue_req(ch, req);
-       return;
-}
-
 void tegra_dma_stop(struct tegra_dma_channel *ch)
 {
        u32 csr;
@@ -248,7 +230,7 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
        }
        if (!found) {
                spin_unlock_irqrestore(&ch->lock, irq_flags);
-               return 0;
+               return -EINVAL;
        }
 
        if (!stop)
@@ -284,8 +266,6 @@ skip_status:
 
        spin_unlock_irqrestore(&ch->lock, irq_flags);
 
-       /* Callback should be called without any lock */
-       req->complete(req);
        return 0;
 }
 EXPORT_SYMBOL(tegra_dma_dequeue_req);
index d385b7a251bec391b2f01d833f963cb9f8e6337c..60b669ae39486f76c069ef8aed84334f9274d045 100644 (file)
@@ -142,7 +142,6 @@ int tegra_dma_enqueue_req(struct tegra_dma_channel *ch,
        struct tegra_dma_req *req);
 int tegra_dma_dequeue_req(struct tegra_dma_channel *ch,
        struct tegra_dma_req *req);
-void tegra_dma_dequeue(struct tegra_dma_channel *ch);
 void tegra_dma_flush(struct tegra_dma_channel *ch);
 
 bool tegra_dma_is_req_inflight(struct tegra_dma_channel *ch,