diff mbox

[v2,14/41] dmaengine: ipu: convert callback to helper function

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

Commit Message

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

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/ipu/ipu_idmac.c |   18 ++++++++----------
 1 file changed, 8 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, 11:29 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: arm-multi_v5_defconfig (attached as .config)
compiler: arm-linux-gnueabi-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=arm 

All errors (new ones prefixed by >>):

   drivers/dma/ipu/ipu_idmac.c: In function 'idmac_interrupt':
>> drivers/dma/ipu/ipu_idmac.c:1166:2: error: unknown type name 'dmaengine_desc_callback'
     dmaengine_desc_callback cb;
     ^
>> drivers/dma/ipu/ipu_idmac.c:1280:46: error: passing argument 2 of 'dmaengine_desc_get_callback' from incompatible pointer type [-Werror=incompatible-pointer-types]
      dmaengine_desc_get_callback(&descnew->txd, &cb);
                                                 ^
   In file included from include/linux/dma/ipu-dma.h:16:0,
                    from drivers/dma/ipu/ipu_idmac.c:25:
   include/linux/dmaengine.h:1381:1: note: expected 'struct dmaengine_desc_callback *' but argument is of type 'int *'
    dmaengine_desc_get_callback(struct dma_async_tx_descriptor *tx,
    ^
>> drivers/dma/ipu/ipu_idmac.c:1285:34: error: passing argument 1 of 'dmaengine_desc_callback_invoke' from incompatible pointer type [-Werror=incompatible-pointer-types]
      dmaengine_desc_callback_invoke(&cb, NULL);
                                     ^
   In file included from include/linux/dma/ipu-dma.h:16:0,
                    from drivers/dma/ipu/ipu_idmac.c:25:
   include/linux/dmaengine.h:1389:1: note: expected 'struct dmaengine_desc_callback *' but argument is of type 'int *'
    dmaengine_desc_callback_invoke(struct dmaengine_desc_callback *cb,
    ^
   drivers/dma/ipu/ipu_idmac.c:1294:42: error: passing argument 2 of 'dmaengine_desc_get_callback' from incompatible pointer type [-Werror=incompatible-pointer-types]
     dmaengine_desc_get_callback(&desc->txd, &cb);
                                             ^
   In file included from include/linux/dma/ipu-dma.h:16:0,
                    from drivers/dma/ipu/ipu_idmac.c:25:
   include/linux/dmaengine.h:1381:1: note: expected 'struct dmaengine_desc_callback *' but argument is of type 'int *'
    dmaengine_desc_get_callback(struct dma_async_tx_descriptor *tx,
    ^
   drivers/dma/ipu/ipu_idmac.c:1299:34: error: passing argument 1 of 'dmaengine_desc_callback_invoke' from incompatible pointer type [-Werror=incompatible-pointer-types]
      dmaengine_desc_callback_invoke(&cb, NULL);
                                     ^
   In file included from include/linux/dma/ipu-dma.h:16:0,
                    from drivers/dma/ipu/ipu_idmac.c:25:
   include/linux/dmaengine.h:1389:1: note: expected 'struct dmaengine_desc_callback *' but argument is of type 'int *'
    dmaengine_desc_callback_invoke(struct dmaengine_desc_callback *cb,
    ^
   cc1: some warnings being treated as errors

vim +/dmaengine_desc_callback +1166 drivers/dma/ipu/ipu_idmac.c

  1160		struct scatterlist **sg, *sgnext, *sgnew = NULL;
  1161		/* Next transfer descriptor */
  1162		struct idmac_tx_desc *desc, *descnew;
  1163		bool done = false;
  1164		u32 ready0, ready1, curbuf, err;
  1165		unsigned long flags;
> 1166		dmaengine_desc_callback cb;
  1167	
  1168		/* IDMAC has cleared the respective BUFx_RDY bit, we manage the buffer */
  1169	
  1170		dev_dbg(dev, "IDMAC irq %d, buf %d\n", irq, ichan->active_buffer);
  1171	
  1172		spin_lock_irqsave(&ipu_data.lock, flags);
  1173	
  1174		ready0	= idmac_read_ipureg(&ipu_data, IPU_CHA_BUF0_RDY);
  1175		ready1	= idmac_read_ipureg(&ipu_data, IPU_CHA_BUF1_RDY);
  1176		curbuf	= idmac_read_ipureg(&ipu_data, IPU_CHA_CUR_BUF);
  1177		err	= idmac_read_ipureg(&ipu_data, IPU_INT_STAT_4);
  1178	
  1179		if (err & (1 << chan_id)) {
  1180			idmac_write_ipureg(&ipu_data, 1 << chan_id, IPU_INT_STAT_4);
  1181			spin_unlock_irqrestore(&ipu_data.lock, flags);
  1182			/*
  1183			 * Doing this
  1184			 * ichan->sg[0] = ichan->sg[1] = NULL;
  1185			 * you can force channel re-enable on the next tx_submit(), but
  1186			 * this is dirty - think about descriptors with multiple
  1187			 * sg elements.
  1188			 */
  1189			dev_warn(dev, "NFB4EOF on channel %d, ready %x, %x, cur %x\n",
  1190				 chan_id, ready0, ready1, curbuf);
  1191			return IRQ_HANDLED;
  1192		}
  1193		spin_unlock_irqrestore(&ipu_data.lock, flags);
  1194	
  1195		/* Other interrupts do not interfere with this channel */
  1196		spin_lock(&ichan->lock);
  1197		if (unlikely((ichan->active_buffer && (ready1 >> chan_id) & 1) ||
  1198			     (!ichan->active_buffer && (ready0 >> chan_id) & 1)
  1199			     )) {
  1200			spin_unlock(&ichan->lock);
  1201			dev_dbg(dev,
  1202				"IRQ with active buffer still ready on channel %x, "
  1203				"active %d, ready %x, %x!\n", chan_id,
  1204				ichan->active_buffer, ready0, ready1);
  1205			return IRQ_NONE;
  1206		}
  1207	
  1208		if (unlikely(list_empty(&ichan->queue))) {
  1209			ichan->sg[ichan->active_buffer] = NULL;
  1210			spin_unlock(&ichan->lock);
  1211			dev_err(dev,
  1212				"IRQ without queued buffers on channel %x, active %d, "
  1213				"ready %x, %x!\n", chan_id,
  1214				ichan->active_buffer, ready0, ready1);
  1215			return IRQ_NONE;
  1216		}
  1217	
  1218		/*
  1219		 * active_buffer is a software flag, it shows which buffer we are
  1220		 * currently expecting back from the hardware, IDMAC should be
  1221		 * processing the other buffer already
  1222		 */
  1223		sg = &ichan->sg[ichan->active_buffer];
  1224		sgnext = ichan->sg[!ichan->active_buffer];
  1225	
  1226		if (!*sg) {
  1227			spin_unlock(&ichan->lock);
  1228			return IRQ_HANDLED;
  1229		}
  1230	
  1231		desc = list_entry(ichan->queue.next, struct idmac_tx_desc, list);
  1232		descnew = desc;
  1233	
  1234		dev_dbg(dev, "IDMAC irq %d, dma %#llx, next dma %#llx, current %d, curbuf %#x\n",
  1235			irq, (u64)sg_dma_address(*sg),
  1236			sgnext ? (u64)sg_dma_address(sgnext) : 0,
  1237			ichan->active_buffer, curbuf);
  1238	
  1239		/* Find the descriptor of sgnext */
  1240		sgnew = idmac_sg_next(ichan, &descnew, *sg);
  1241		if (sgnext != sgnew)
  1242			dev_err(dev, "Submitted buffer %p, next buffer %p\n", sgnext, sgnew);
  1243	
  1244		/*
  1245		 * if sgnext == NULL sg must be the last element in a scatterlist and
  1246		 * queue must be empty
  1247		 */
  1248		if (unlikely(!sgnext)) {
  1249			if (!WARN_ON(sg_next(*sg)))
  1250				dev_dbg(dev, "Underrun on channel %x\n", chan_id);
  1251			ichan->sg[!ichan->active_buffer] = sgnew;
  1252	
  1253			if (unlikely(sgnew)) {
  1254				ipu_submit_buffer(ichan, descnew, sgnew, !ichan->active_buffer);
  1255			} else {
  1256				spin_lock_irqsave(&ipu_data.lock, flags);
  1257				ipu_ic_disable_task(&ipu_data, chan_id);
  1258				spin_unlock_irqrestore(&ipu_data.lock, flags);
  1259				ichan->status = IPU_CHANNEL_READY;
  1260				/* Continue to check for complete descriptor */
  1261			}
  1262		}
  1263	
  1264		/* Calculate and submit the next sg element */
  1265		sgnew = idmac_sg_next(ichan, &descnew, sgnew);
  1266	
  1267		if (unlikely(!sg_next(*sg)) || !sgnext) {
  1268			/*
  1269			 * Last element in scatterlist done, remove from the queue,
  1270			 * _init for debugging
  1271			 */
  1272			list_del_init(&desc->list);
  1273			done = true;
  1274		}
  1275	
  1276		*sg = sgnew;
  1277	
  1278		if (likely(sgnew) &&
  1279		    ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) {
> 1280			dmaengine_desc_get_callback(&descnew->txd, &cb);
  1281	
  1282			list_del_init(&descnew->list);
  1283			spin_unlock(&ichan->lock);
  1284	
> 1285			dmaengine_desc_callback_invoke(&cb, NULL);
  1286			spin_lock(&ichan->lock);
  1287		}
  1288	

---
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/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index b54f62d..85b5c36 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -1160,11 +1160,10 @@  static irqreturn_t idmac_interrupt(int irq, void *dev_id)
 	struct scatterlist **sg, *sgnext, *sgnew = NULL;
 	/* Next transfer descriptor */
 	struct idmac_tx_desc *desc, *descnew;
-	dma_async_tx_callback callback;
-	void *callback_param;
 	bool done = false;
 	u32 ready0, ready1, curbuf, err;
 	unsigned long flags;
+	dmaengine_desc_callback cb;
 
 	/* IDMAC has cleared the respective BUFx_RDY bit, we manage the buffer */
 
@@ -1278,12 +1277,12 @@  static irqreturn_t idmac_interrupt(int irq, void *dev_id)
 
 	if (likely(sgnew) &&
 	    ipu_submit_buffer(ichan, descnew, sgnew, ichan->active_buffer) < 0) {
-		callback = descnew->txd.callback;
-		callback_param = descnew->txd.callback_param;
+		dmaengine_desc_get_callback(&descnew->txd, &cb);
+
 		list_del_init(&descnew->list);
 		spin_unlock(&ichan->lock);
-		if (callback)
-			callback(callback_param);
+
+		dmaengine_desc_callback_invoke(&cb, NULL);
 		spin_lock(&ichan->lock);
 	}
 
@@ -1292,13 +1291,12 @@  static irqreturn_t idmac_interrupt(int irq, void *dev_id)
 	if (done)
 		dma_cookie_complete(&desc->txd);
 
-	callback = desc->txd.callback;
-	callback_param = desc->txd.callback_param;
+	dmaengine_desc_get_callback(&desc->txd, &cb);
 
 	spin_unlock(&ichan->lock);
 
-	if (done && (desc->txd.flags & DMA_PREP_INTERRUPT) && callback)
-		callback(callback_param);
+	if (done && (desc->txd.flags & DMA_PREP_INTERRUPT))
+		dmaengine_desc_callback_invoke(&cb, NULL);
 
 	return IRQ_HANDLED;
 }