Adding dmaengine core helper function in order to prep for error reporting. Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx> --- drivers/dma/dmaengine.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h index 17f983a..6fb5edc 100644 --- a/drivers/dma/dmaengine.h +++ b/drivers/dma/dmaengine.h @@ -86,4 +86,34 @@ static inline void dma_set_residue(struct dma_tx_state *state, u32 residue) state->residue = residue; } +struct dmaengine_desc_callback { + dma_async_tx_callback callback; + void *callback_param; +}; + +static inline void +dmaengine_desc_get_callback(struct dma_async_tx_descriptor *tx, + struct dmaengine_desc_callback *cb) +{ + cb->callback = tx->callback; + cb->callback_param = tx->callback_param; +} + +static inline void +dmaengine_desc_callback_invoke(struct dmaengine_desc_callback *cb, + const void *result) +{ + if (cb->callback) + cb->callback(cb->callback_param); +} + +static inline void +dmaengine_desc_get_callback_invoke(struct dma_async_tx_descriptor *tx, + struct dmaengine_desc_callback *cb, + const void *result) +{ + dmaengine_desc_get_callback(tx, cb); + dmaengine_desc_callback_invoke(cb, result); +} + #endif -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html