diff mbox

[v2,01/41] dmaengine: Add helper function to prep for error reporting

Message ID 146861387148.154751.1439114684229113912.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Dave Jiang July 15, 2016, 8:17 p.m. UTC
Adding dmaengine core helper function in order to prep for error
reporting.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 include/linux/dmaengine.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 30de019..95cf217 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1372,6 +1372,27 @@  static inline int dmaengine_desc_free(struct dma_async_tx_descriptor *desc)
 		return -EPERM;
 }
 
+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,
+			       void *result)
+{
+	if (cb->callback)
+		cb->callback(cb->callback_param);
+}
+
 /* --- DMA device --- */
 
 int dma_async_device_register(struct dma_device *device);