[Sound-open-firmware] [PATCH 4/8] core: dma: add return value to DMA set callback.

Keyon Jie yang.jie at linux.intel.com
Thu Feb 8 13:48:09 CET 2018


From: Liam Girdwood <liam.r.girdwood at linux.intel.com>

Let clients know if they can expect a callback from DMA.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/drivers/dw-dma.c   | 4 +++-
 src/include/reef/dma.h | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c
index cbfed0e..c566509 100644
--- a/src/drivers/dw-dma.c
+++ b/src/drivers/dw-dma.c
@@ -729,7 +729,7 @@ static int dw_dma_pm_context_store(struct dma *dma)
 	return 0;
 }
 
-static void dw_dma_set_cb(struct dma *dma, int channel, int type,
+static int dw_dma_set_cb(struct dma *dma, int channel, int type,
 		void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next),
 		void *data)
 {
@@ -741,6 +741,8 @@ static void dw_dma_set_cb(struct dma *dma, int channel, int type,
 	p->chan[channel].cb_data = data;
 	p->chan[channel].cb_type = type;
 	spin_unlock_irq(&dma->lock, flags);
+
+	return 0;
 }
 
 /* reload using LLI data */
diff --git a/src/include/reef/dma.h b/src/include/reef/dma.h
index aab9217..71bce56 100644
--- a/src/include/reef/dma.h
+++ b/src/include/reef/dma.h
@@ -103,7 +103,7 @@ struct dma_ops {
 	int (*set_config)(struct dma *dma, int channel,
 		struct dma_sg_config *config);
 
-	void (*set_cb)(struct dma *dma, int channel, int type,
+	int (*set_cb)(struct dma *dma, int channel, int type,
 		void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next),
 		void *data);
 
@@ -173,10 +173,10 @@ static inline void dma_channel_put(struct dma *dma, int channel)
 	dma->ops->channel_put(dma, channel);
 }
 
-static inline void dma_set_cb(struct dma *dma, int channel, int type,
+static inline int dma_set_cb(struct dma *dma, int channel, int type,
 	void (*cb)(void *data, uint32_t type, struct dma_sg_elem *next), void *data)
 {
-	dma->ops->set_cb(dma, channel, type, cb, data);
+	return dma->ops->set_cb(dma, channel, type, cb, data);
 }
 
 static inline int dma_start(struct dma *dma, int channel)
-- 
2.11.0



More information about the Sound-open-firmware mailing list