fsldma: improve link descriptor debugging

This adds better tracking to link descriptor allocations, callbacks, and
frees. This makes it much easier to track errors with link descriptors.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Ira Snyder 2011-03-03 07:54:56 +00:00 committed by Dan Williams
parent b158471ef6
commit 0ab09c3681
1 changed files with 15 additions and 6 deletions

View File

@ -420,6 +420,10 @@ static struct fsl_desc_sw *fsl_dma_alloc_descriptor(
desc->async_tx.tx_submit = fsl_dma_tx_submit; desc->async_tx.tx_submit = fsl_dma_tx_submit;
desc->async_tx.phys = pdesc; desc->async_tx.phys = pdesc;
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "LD %p allocated\n", desc);
#endif
return desc; return desc;
} }
@ -470,6 +474,9 @@ static void fsldma_free_desc_list(struct fsldma_chan *chan,
list_for_each_entry_safe(desc, _desc, list, node) { list_for_each_entry_safe(desc, _desc, list, node) {
list_del(&desc->node); list_del(&desc->node);
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "LD %p free\n", desc);
#endif
dma_pool_free(chan->desc_pool, desc, desc->async_tx.phys); dma_pool_free(chan->desc_pool, desc, desc->async_tx.phys);
} }
} }
@ -481,6 +488,9 @@ static void fsldma_free_desc_list_reverse(struct fsldma_chan *chan,
list_for_each_entry_safe_reverse(desc, _desc, list, node) { list_for_each_entry_safe_reverse(desc, _desc, list, node) {
list_del(&desc->node); list_del(&desc->node);
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "LD %p free\n", desc);
#endif
dma_pool_free(chan->desc_pool, desc, desc->async_tx.phys); dma_pool_free(chan->desc_pool, desc, desc->async_tx.phys);
} }
} }
@ -557,9 +567,6 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy(
chan_err(chan, "%s\n", msg_ld_oom); chan_err(chan, "%s\n", msg_ld_oom);
goto fail; goto fail;
} }
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "new link desc alloc %p\n", new);
#endif
copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT); copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT);
@ -645,9 +652,6 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_sg(struct dma_chan *dchan,
chan_err(chan, "%s\n", msg_ld_oom); chan_err(chan, "%s\n", msg_ld_oom);
goto fail; goto fail;
} }
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "new link desc alloc %p\n", new);
#endif
set_desc_cnt(chan, &new->hw, len); set_desc_cnt(chan, &new->hw, len);
set_desc_src(chan, &new->hw, src); set_desc_src(chan, &new->hw, src);
@ -882,13 +886,18 @@ static void fsl_chan_ld_cleanup(struct fsldma_chan *chan)
callback_param = desc->async_tx.callback_param; callback_param = desc->async_tx.callback_param;
if (callback) { if (callback) {
spin_unlock_irqrestore(&chan->desc_lock, flags); spin_unlock_irqrestore(&chan->desc_lock, flags);
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "LD %p callback\n", desc); chan_dbg(chan, "LD %p callback\n", desc);
#endif
callback(callback_param); callback(callback_param);
spin_lock_irqsave(&chan->desc_lock, flags); spin_lock_irqsave(&chan->desc_lock, flags);
} }
/* Run any dependencies, then free the descriptor */ /* Run any dependencies, then free the descriptor */
dma_run_dependencies(&desc->async_tx); dma_run_dependencies(&desc->async_tx);
#ifdef FSL_DMA_LD_DEBUG
chan_dbg(chan, "LD %p free\n", desc);
#endif
dma_pool_free(chan->desc_pool, desc, desc->async_tx.phys); dma_pool_free(chan->desc_pool, desc, desc->async_tx.phys);
} }