diff options
author | Timur Tabi <timur@freescale.com> | 2008-09-19 07:16:19 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2008-09-19 07:16:19 -0400 |
commit | 6b3141962dc82cfe1c30afdf91d564b309859cbe (patch) | |
tree | 51a0045ba900f44083fbd2693824414262534dbc /drivers/dma | |
parent | 89f72a0633d1d4f28c4c5c8831ec814523d7671a (diff) |
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.
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | 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 a08d19704743..422500c6c163 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) | |||
325 | struct dmatest_thread *thread; | 325 | struct dmatest_thread *thread; |
326 | unsigned int i; | 326 | unsigned int i; |
327 | 327 | ||
328 | /* Have we already been told about this channel? */ | ||
329 | list_for_each_entry(dtc, &dmatest_channels, node) | ||
330 | if (dtc->chan == chan) | ||
331 | return DMA_DUP; | ||
332 | |||
328 | dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC); | 333 | dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC); |
329 | if (!dtc) { | 334 | if (!dtc) { |
330 | pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id); | 335 | pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id); |