diff mbox

[v2,27/41] dmaengine: sh_shdma-base: convert callback to helper function

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

Commit Message

Dave Jiang July 15, 2016, 8:20 p.m. UTC
Convert driver to use the new helper function for callback

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/sh/shdma-base.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)


--
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

Comments

kernel test robot July 15, 2016, 10:04 p.m. UTC | #1
Hi,

[auto build test ERROR on v4.7-rc7]
[also build test ERROR on next-20160715]
[cannot apply to slave-dma/next xlnx/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dave-Jiang/Adding-transaction-result-return-for-dmaengine/20160716-044852
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

   drivers/dma/sh/shdma-base.c: In function 'shdma_reset':
>> drivers/dma/sh/shdma-base.c:886:29: error: storage size of 'cb' isn't known
       struct dmaengine_desc_cb cb;
                                ^
>> drivers/dma/sh/shdma-base.c:886:29: warning: unused variable 'cb' [-Wunused-variable]

vim +886 drivers/dma/sh/shdma-base.c

   880	
   881			spin_unlock(&schan->chan_lock);
   882	
   883			/* Complete all  */
   884			list_for_each_entry(sdesc, &dl, node) {
   885				struct dma_async_tx_descriptor *tx = &sdesc->async_tx;
 > 886				struct dmaengine_desc_cb cb;
   887	
   888				sdesc->mark = DESC_IDLE;
   889				dmaengine_desc_get_callback(tx, &cb);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 10fcaba..432c325 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -329,11 +329,11 @@  static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
 	/* Is the "exposed" head of a chain acked? */
 	bool head_acked = false;
 	dma_cookie_t cookie = 0;
-	dma_async_tx_callback callback = NULL;
-	void *param = NULL;
+	struct dmaengine_desc_callback cb;
 	unsigned long flags;
 	LIST_HEAD(cyclic_list);
 
+	cb.callback = NULL;
 	spin_lock_irqsave(&schan->chan_lock, flags);
 	list_for_each_entry_safe(desc, _desc, &schan->ld_queue, node) {
 		struct dma_async_tx_descriptor *tx = &desc->async_tx;
@@ -367,8 +367,7 @@  static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
 		/* Call callback on the last chunk */
 		if (desc->mark == DESC_COMPLETED && tx->callback) {
 			desc->mark = DESC_WAITING;
-			callback = tx->callback;
-			param = tx->callback_param;
+			dmaengine_desc_get_callback(tx, &cb);
 			dev_dbg(schan->dev, "descriptor #%d@%p on %d callback\n",
 				tx->cookie, tx, schan->id);
 			BUG_ON(desc->chunks != 1);
@@ -419,7 +418,7 @@  static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
 		}
 	}
 
-	if (all && !callback)
+	if (all && !cb.callback)
 		/*
 		 * Terminating and the loop completed normally: forgive
 		 * uncompleted cookies
@@ -430,10 +429,9 @@  static dma_async_tx_callback __ld_cleanup(struct shdma_chan *schan, bool all)
 
 	spin_unlock_irqrestore(&schan->chan_lock, flags);
 
-	if (callback)
-		callback(param);
+	dmaengine_desc_callback_invoke(&cb, NULL);
 
-	return callback;
+	return cb.callback;
 }
 
 /*
@@ -885,9 +883,11 @@  bool shdma_reset(struct shdma_dev *sdev)
 		/* Complete all  */
 		list_for_each_entry(sdesc, &dl, node) {
 			struct dma_async_tx_descriptor *tx = &sdesc->async_tx;
+			struct dmaengine_desc_cb cb;
+
 			sdesc->mark = DESC_IDLE;
-			if (tx->callback)
-				tx->callback(tx->callback_param);
+			dmaengine_desc_get_callback(tx, &cb);
+			dmaengine_desc_callback_invoke(&cb, NULL);
 		}
 
 		spin_lock(&schan->chan_lock);