From b7f9c567e6b95074087584672773a167224608d3 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 16 Mar 2011 16:53:24 -0700 Subject: [PATCH] ARM: tegra: dma: Do not call complete callback on canceled requests 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 --- arch/arm/mach-tegra/dma.c | 22 +--------------------- arch/arm/mach-tegra/include/mach/dma.h | 1 - 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c index db94fcf58399..44f70a9cde7a 100644 --- a/arch/arm/mach-tegra/dma.c +++ b/arch/arm/mach-tegra/dma.c @@ -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); diff --git a/arch/arm/mach-tegra/include/mach/dma.h b/arch/arm/mach-tegra/include/mach/dma.h index d385b7a251be..60b669ae3948 100644 --- a/arch/arm/mach-tegra/include/mach/dma.h +++ b/arch/arm/mach-tegra/include/mach/dma.h @@ -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, -- 2.34.1