[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1221754217-26974-1-git-send-email-timur@freescale.com>
Date: Thu, 18 Sep 2008 11:10:17 -0500
From: Timur Tabi <timur@...escale.com>
To: dan.j.williams@...el.com, haavard.skinnemoen@...el.com,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] dmatest: properly handle duplicate DMA channels
Update the the dmatest driver so that it handles duplicate DMA channels
properly.
When a DMA client is notified of an available DMA channel, it must check if it
has already allocated resources for that channel. If so, it should return
DMA_DUP. This can happen, for example, if a DMA driver calls
dma_async_device_register() more than once.
Signed-off-by: Timur Tabi <timur@...escale.com>
---
Replaced list_for_each_entry_safe() with list_for_each_entry()
drivers/dma/dmatest.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index a08d197..422500c 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -325,6 +325,11 @@ static enum dma_state_client dmatest_add_channel(struct dma_chan *chan)
struct dmatest_thread *thread;
unsigned int i;
+ /* Have we already been told about this channel? */
+ list_for_each_entry(dtc, &dmatest_channels, node)
+ if (dtc->chan == chan)
+ return DMA_DUP;
+
dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC);
if (!dtc) {
pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id);
--
1.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists