* [PATCH v2] dmatest: properly handle duplicate DMA channels
@ 2008-09-18 16:10 Timur Tabi
2008-09-18 16:16 ` Haavard Skinnemoen
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2008-09-18 16:10 UTC (permalink / raw)
To: dan.j.williams, haavard.skinnemoen, linux-kernel
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@freescale.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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] dmatest: properly handle duplicate DMA channels
2008-09-18 16:10 [PATCH v2] dmatest: properly handle duplicate DMA channels Timur Tabi
@ 2008-09-18 16:16 ` Haavard Skinnemoen
0 siblings, 0 replies; 2+ messages in thread
From: Haavard Skinnemoen @ 2008-09-18 16:16 UTC (permalink / raw)
To: Timur Tabi; +Cc: dan.j.williams, linux-kernel
Timur Tabi <timur@freescale.com> wrote:
> 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@freescale.com>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-18 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-18 16:10 [PATCH v2] dmatest: properly handle duplicate DMA channels Timur Tabi
2008-09-18 16:16 ` Haavard Skinnemoen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®