Skip to contentSkip to conversation

: dmaengine: use DMA_COMPLETE for dma completion status

PATCH In review Vinod Koul 13 participants 59 messages Oct 16, 2013 – Nov 12, 2013

Subsystems (15)
lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

cover : dmaengine: use DMA_COMPLETE for dma completion status

As we recently discussed in [1], the DMA_SUCCESS is an misnomer. The dmaengine does not acknowledge that dma completed succesfully. It can only signal dma was completed by it. Hence we should use DMA_COMPLTE as status instead of DMA_SUCCESS

[1]: http://www.spinics.net/lists/arm-kernel/msg278346.html

Vinod Koul (28):
dmaengine: use DMA_COMPLETE for dma completion status
dmaengine: amba-pl08x: use DMA_COMPLETE for dma completion status
dmaengine: at_hdma: use DMA_COMPLETE for dma completion status
dmaengine: coh901318: use DMA_COMPLETE for dma completion status
dmaengine: cppi41: use DMA_COMPLETE for dma completion status
dmaengine: jz4740: use DMA_COMPLETE for dma completion status
dmaengine: dmatest: use DMA_COMPLETE for dma completion status
dmaengine: dw: use DMA_COMPLETE for dma completion status
dmaengine: edma: use DMA_COMPLETE for dma completion status
dmaengine: imx-dma: use DMA_COMPLETE for dma completion status
dmaengine: imx-sdma: use DMA_COMPLETE for dma completion status
dmaengine: intel_mid_dma: use DMA_COMPLETE for dma completion status
dmaengine: ioat: use DMA_COMPLETE for dma completion status
dmaengine: iop: use DMA_COMPLETE for dma completion status
dmaengine: k3dma: use DMA_COMPLETE for dma completion status
dmaengine: mmp_tdma: use DMA_COMPLETE for dma completion status
dmaengine: mv_xor: use DMA_COMPLETE for dma completion status
dmaengine: mxs-dma: use DMA_COMPLETE for dma completion status
dmaengine: omap: use DMA_COMPLETE for dma completion status
dmaengine: ppc4xx: use DMA_COMPLETE for dma completion status
dmaengine: sa11x0: use DMA_COMPLETE for dma completion status
dmaengine: sh: use DMA_COMPLETE for dma completion status
dmaengine: ste: use DMA_COMPLETE for dma completion status
dmaengine: tegra: use DMA_COMPLETE for dma completion status
dmaengine: txx9: use DMA_COMPLETE for dma completion status
async_tx: use DMA_COMPLETE for dma completion status
serial: sh: use DMA_COMPLETE for dma completion status
net: use DMA_COMPLETE for dma completion status

 crypto/async_tx/async_tx.c    |    4 ++--
 drivers/dma/amba-pl08x.c      |    4 ++--
 drivers/dma/at_hdmac.c        |    2 +-
 drivers/dma/coh901318.c       |    2 +-
 drivers/dma/cppi41.c          |    2 +-
 drivers/dma/dma-jz4740.c      |    2 +-
 drivers/dma/dmaengine.c       |    2 +-
 drivers/dma/dmatest.c         |    2 +-
 drivers/dma/dw/core.c         |    4 ++--
 drivers/dma/edma.c            |    2 +-
 drivers/dma/imx-dma.c         |    2 +-
 drivers/dma/imx-sdma.c        |    2 +-
 drivers/dma/intel_mid_dma.c   |    4 ++--
 drivers/dma/ioat/dma.c        |    4 ++--
 drivers/dma/ioat/dma_v3.c     |    8 ++++----
 drivers/dma/iop-adma.c        |   16 ++++++++--------
 drivers/dma/k3dma.c           |    2 +-
 drivers/dma/mmp_tdma.c        |    6 +++---
 drivers/dma/mv_xor.c          |    6 +++---
 drivers/dma/mxs-dma.c         |    6 +++---
 drivers/dma/omap-dma.c        |    2 +-
 drivers/dma/ppc4xx/adma.c     |    2 +-
 drivers/dma/sa11x0-dma.c      |    2 +-
 drivers/dma/sh/shdma-base.c   |    2 +-
 drivers/dma/ste_dma40.c       |    2 +-
 drivers/dma/tegra20-apb-dma.c |    4 ++--
 drivers/dma/txx9dmac.c        |    4 ++--
 drivers/tty/serial/sh-sci.c   |    2 +-
 include/linux/dmaengine.h     |   12 ++++++------
 net/ipv4/tcp.c                |    4 ++--
 30 files changed, 59 insertions(+), 59 deletions(-)

Thanks
~Vinod

author
#1 lore raw

PATCH 1/28 dmaengine: use DMA_COMPLETE for dma completion status

the DMA_SUCCESS is a misnomer as dmaengine indicates the transfer is complete and gives no guarantee of the transfer success. Hence we should use DMA_COMPLTE instead of DMA_SUCCESS

---
 drivers/dma/dmaengine.c   |    2 +-
 include/linux/dmaengine.h |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/dma/dmaengine.c +1 -1
index 9162ac8..81d8765 100644
@@ -1062,7 +1062,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 	unsigned long dma_sync_wait_timeout = jiffies + msecs_to_jiffies(5000);
 
 	if (!tx)
-		return DMA_SUCCESS;
+		return DMA_COMPLETE;
 
 	while (tx->cookie == -EBUSY) {
 		if (time_after_eq(jiffies, dma_sync_wait_timeout)) {
include/linux/dmaengine.h +6 -6
index 0bc7275..4b460a6 100644
@@ -45,13 +45,13 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
@@ -979,10 +979,10 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
 {
 	if (last_complete <= last_used) {
 		if ((cookie <= last_complete) || (cookie > last_used))
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;
 	} else {
 		if ((cookie <= last_complete) && (cookie > last_used))
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;
 	}
 	return DMA_IN_PROGRESS;
 }
@@ -1013,11 +1013,11 @@ static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_typ
 }
 static inline enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
 {
-	return DMA_SUCCESS;
+	return DMA_COMPLETE;
 }
 static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 {
-	return DMA_SUCCESS;
+	return DMA_COMPLETE;
 }
 static inline void dma_issue_pending_all(void)
 {
Signature · 1 line
1.7.0.4
author
#22 lore raw

PATCH 2/28 dmaengine: amba-pl08x: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Linus Walleij <[email protected]>
---
 drivers/dma/amba-pl08x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/amba-pl08x.c +2 -2
index 9b50257..4ee6533 100644
@@ -1252,7 +1252,7 @@ static enum dma_status pl08x_dma_tx_status(struct dma_chan *chan,
 	size_t bytes = 0;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	/*
@@ -1267,7 +1267,7 @@ static enum dma_status pl08x_dma_tx_status(struct dma_chan *chan,
 
 	spin_lock_irqsave(&plchan->vc.lock, flags);
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret != DMA_SUCCESS) {
+	if (ret != DMA_COMPLETE) {
 		vd = vchan_find_desc(&plchan->vc, cookie);
 		if (vd) {
 			/* On the issued list, so hasn't been processed yet */
Signature · 1 line
1.7.0.4
author
#23 lore raw

PATCH 3/28 dmaengine: at_hdma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Nicolas Ferre <[email protected]>
---
 drivers/dma/at_hdmac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/at_hdmac.c +1 -1
index c787f38..1ef7457 100644
@@ -1102,7 +1102,7 @@ atc_tx_status(struct dma_chan *chan,
 	int bytes = 0;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 	/*
 	 * There's no point calculating the residue if there's
Signature · 1 line
1.7.0.4
author
#25 lore raw

PATCH 4/28 dmaengine: coh901318: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Linus Walleij <[email protected]>
---
 drivers/dma/coh901318.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/coh901318.c +1 -1
index 3025b91..3c6716e 100644
@@ -2369,7 +2369,7 @@ coh901318_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	dma_set_residue(txstate, coh901318_get_bytes_left(chan));
Signature · 1 line
1.7.0.4
author
#26 lore raw

PATCH 5/28 dmaengine: cppi41: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Sebastian Andrzej Siewior <[email protected]>
---
 drivers/dma/cppi41.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/cppi41.c +1 -1
index 167c022..278b305 100644
@@ -353,7 +353,7 @@ static enum dma_status cppi41_dma_tx_status(struct dma_chan *chan,
 
 	/* lock */
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (txstate && ret == DMA_SUCCESS)
+	if (txstate && ret == DMA_COMPLETE)
 		txstate->residue = c->residue;
 	/* unlock */
 
Signature · 1 line
1.7.0.4
author
#27 lore raw

PATCH 6/28 dmaengine: jz4740: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Lars-Peter Clausen <[email protected]>
---
 drivers/dma/dma-jz4740.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/dma-jz4740.c +1 -1
index b0c0c82..94c380f 100644
@@ -491,7 +491,7 @@ static enum dma_status jz4740_dma_tx_status(struct dma_chan *c,
 	unsigned long flags;
 
 	status = dma_cookie_status(c, cookie, state);
-	if (status == DMA_SUCCESS || !state)
+	if (status == DMA_COMPLETE || !state)
 		return status;
 
 	spin_lock_irqsave(&chan->vchan.lock, flags);
Signature · 1 line
1.7.0.4
author
#28 lore raw

PATCH 7/28 dmaengine: dmatest: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/dmatest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/dmatest.c +1 -1
index 92f796c..59e287f 100644
@@ -740,7 +740,7 @@ static int dmatest_func(void *data)
 					  len, 0);
 			failed_tests++;
 			continue;
-		} else if (status != DMA_SUCCESS) {
+		} else if (status != DMA_COMPLETE) {
 			enum dmatest_error_type type = (status == DMA_ERROR) ?
 				DMATEST_ET_DMA_ERROR : DMATEST_ET_DMA_IN_PROGRESS;
 			thread_result_add(info, result, type,
Signature · 1 line
1.7.0.4
author
#29 lore raw

PATCH 8/28 dmaengine: dw: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Andy Shevchenko <[email protected]>
CC Viresh Kumar <[email protected]>
---
 drivers/dma/dw/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dw/core.c +2 -2
index 89eb89f..2c29331 100644
@@ -1098,13 +1098,13 @@ dwc_tx_status(struct dma_chan *chan,
 	enum dma_status		ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret != DMA_SUCCESS)
+	if (ret != DMA_COMPLETE)
 		dma_set_residue(txstate, dwc_get_residue(dwc));
 
 	if (dwc->paused && ret == DMA_IN_PROGRESS)
Signature · 1 line
1.7.0.4
author
#32 lore raw

PATCH 9/28 dmaengine: edma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Joel Fernandes <[email protected]>
---
 drivers/dma/edma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/edma.c +1 -1
index 098a8da..29fa358 100644
@@ -576,7 +576,7 @@ static enum dma_status edma_tx_status(struct dma_chan *chan,
 	unsigned long flags;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS || !txstate)
+	if (ret == DMA_COMPLETE || !txstate)
 		return ret;
 
 	spin_lock_irqsave(&echan->vchan.lock, flags);
Signature · 1 line
1.7.0.4
author
#34 lore raw

PATCH 10/28 dmaengine: imx-dma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/imx-dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/imx-dma.c +1 -1
index 55852c0..2af4028 100644
@@ -771,7 +771,7 @@ static int imxdma_alloc_chan_resources(struct dma_chan *chan)
 		desc->desc.tx_submit = imxdma_tx_submit;
 		/* txd.flags will be overwritten in prep funcs */
 		desc->desc.flags = DMA_CTRL_ACK;
-		desc->status = DMA_SUCCESS;
+		desc->status = DMA_COMPLETE;
 
 		list_add_tail(&desc->node, &imxdmac->ld_free);
 		imxdmac->descs_allocated++;
Signature · 1 line
1.7.0.4
author
#35 lore raw

PATCH 11/28 dmaengine: imx-sdma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Acked-by: Shawn Guo <[email protected]>
---
 drivers/dma/imx-sdma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/imx-sdma.c +1 -1
index fc43603..0e03b31 100644
@@ -638,7 +638,7 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)
 	if (error)
 		sdmac->status = DMA_ERROR;
 	else
-		sdmac->status = DMA_SUCCESS;
+		sdmac->status = DMA_COMPLETE;
 
 	dma_cookie_complete(&sdmac->desc);
 	if (sdmac->desc.callback)
Signature · 1 line
1.7.0.4
author
#36 lore raw

PATCH 12/28 dmaengine: intel_mid_dma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/intel_mid_dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/intel_mid_dma.c +2 -2
index a975ebe..1aab813 100644
@@ -309,7 +309,7 @@ static void midc_descriptor_complete(struct intel_mid_dma_chan *midc,
 		callback_txd(param_txd);
 	}
 	if (midc->raw_tfr) {
-		desc->status = DMA_SUCCESS;
+		desc->status = DMA_COMPLETE;
 		if (desc->lli != NULL) {
 			pci_pool_free(desc->lli_pool, desc->lli,
 						desc->lli_phys);
@@ -481,7 +481,7 @@ static enum dma_status intel_mid_dma_tx_status(struct dma_chan *chan,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret != DMA_SUCCESS) {
+	if (ret != DMA_COMPLETE) {
 		spin_lock_bh(&midc->lock);
 		midc_scan_descriptors(to_middma_device(chan->device), midc);
 		spin_unlock_bh(&midc->lock);
Signature · 1 line
1.7.0.4
author
#37 lore raw

PATCH 13/28 dmaengine: ioat: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/ioat/dma.c    |    4 ++--
 drivers/dma/ioat/dma_v3.c |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/dma/ioat/dma.c +2 -2
index 5ff6fc1..a0f0fce 100644
@@ -733,7 +733,7 @@ ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(c, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	device->cleanup_fn((unsigned long) c);
@@ -859,7 +859,7 @@ int ioat_dma_self_test(struct ioatdma_device *device)
 
 	if (tmo == 0 ||
 	    dma->device_tx_status(dma_chan, cookie, NULL)
-					!= DMA_SUCCESS) {
+					!= DMA_COMPLETE) {
 		dev_err(dev, "Self-test copy timed out, disabling\n");
 		err = -ENODEV;
 		goto unmap_dma;
drivers/dma/ioat/dma_v3.c +4 -4
index d8ececa..806b4ce 100644
@@ -807,7 +807,7 @@ ioat3_tx_status(struct dma_chan *c, dma_cookie_t cookie,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(c, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	ioat3_cleanup(ioat);
@@ -1468,7 +1468,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
 
 	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
 
-	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
+	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dev, "Self-test xor timed out\n");
 		err = -ENODEV;
 		goto dma_unmap;
@@ -1530,7 +1530,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
 
 	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
 
-	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
+	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dev, "Self-test validate timed out\n");
 		err = -ENODEV;
 		goto dma_unmap;
@@ -1577,7 +1577,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device)
 
 	tmo = wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000));
 
-	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
+	if (dma->device_tx_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dev, "Self-test 2nd validate timed out\n");
 		err = -ENODEV;
 		goto dma_unmap;
Signature · 1 line
1.7.0.4
author
#38 lore raw

PATCH 14/28 dmaengine: iop: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/iop-adma.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/dma/iop-adma.c +8 -8
index dd8b44a..408fe6b 100644
@@ -864,7 +864,7 @@ static enum dma_status iop_adma_status(struct dma_chan *chan,
 	int ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	iop_adma_slot_cleanup(iop_chan);
@@ -983,7 +983,7 @@ static int iop_adma_memcpy_self_test(struct iop_adma_device *device)
 	msleep(1);
 
 	if (iop_adma_status(dma_chan, cookie, NULL) !=
-			DMA_SUCCESS) {
+			DMA_COMPLETE) {
 		dev_err(dma_chan->device->dev,
 			"Self-test copy timed out, disabling\n");
 		err = -ENODEV;
@@ -1083,7 +1083,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
 	msleep(8);
 
 	if (iop_adma_status(dma_chan, cookie, NULL) !=
-		DMA_SUCCESS) {
+		DMA_COMPLETE) {
 		dev_err(dma_chan->device->dev,
 			"Self-test xor timed out, disabling\n");
 		err = -ENODEV;
@@ -1129,7 +1129,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
 	iop_adma_issue_pending(dma_chan);
 	msleep(8);
 
-	if (iop_adma_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
+	if (iop_adma_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dma_chan->device->dev,
 			"Self-test zero sum timed out, disabling\n");
 		err = -ENODEV;
@@ -1158,7 +1158,7 @@ iop_adma_xor_val_self_test(struct iop_adma_device *device)
 	iop_adma_issue_pending(dma_chan);
 	msleep(8);
 
-	if (iop_adma_status(dma_chan, cookie, NULL) != DMA_SUCCESS) {
+	if (iop_adma_status(dma_chan, cookie, NULL) != DMA_COMPLETE) {
 		dev_err(dma_chan->device->dev,
 			"Self-test non-zero sum timed out, disabling\n");
 		err = -ENODEV;
@@ -1254,7 +1254,7 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
 	msleep(8);
 
 	if (iop_adma_status(dma_chan, cookie, NULL) !=
-		DMA_SUCCESS) {
+		DMA_COMPLETE) {
 		dev_err(dev, "Self-test pq timed out, disabling\n");
 		err = -ENODEV;
 		goto free_resources;
@@ -1291,7 +1291,7 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
 	msleep(8);
 
 	if (iop_adma_status(dma_chan, cookie, NULL) !=
-		DMA_SUCCESS) {
+		DMA_COMPLETE) {
 		dev_err(dev, "Self-test pq-zero-sum timed out, disabling\n");
 		err = -ENODEV;
 		goto free_resources;
@@ -1323,7 +1323,7 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device)
 	msleep(8);
 
 	if (iop_adma_status(dma_chan, cookie, NULL) !=
-		DMA_SUCCESS) {
+		DMA_COMPLETE) {
 		dev_err(dev, "Self-test !pq-zero-sum timed out, disabling\n");
 		err = -ENODEV;
 		goto free_resources;
Signature · 1 line
1.7.0.4
author
#39 lore raw

PATCH 15/28 dmaengine: k3dma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/k3dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/k3dma.c +1 -1
index da43062..e260754 100644
@@ -344,7 +344,7 @@ static enum dma_status k3_dma_tx_status(struct dma_chan *chan,
 	size_t bytes = 0;
 
 	ret = dma_cookie_status(&c->vc.chan, cookie, state);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	spin_lock_irqsave(&c->vc.lock, flags);
Signature · 1 line
1.7.0.4
author
#41 lore raw

PATCH 16/28 dmaengine: mmp_tdma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/mmp_tdma.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/dma/mmp_tdma.c +3 -3
index 8f3e865..2b4026d 100644
@@ -163,7 +163,7 @@ static void mmp_tdma_disable_chan(struct mmp_tdma_chan *tdmac)
 	/* disable irq */
 	writel(0, tdmac->reg_base + TDIMR);
 
-	tdmac->status = DMA_SUCCESS;
+	tdmac->status = DMA_COMPLETE;
 }
 
 static void mmp_tdma_resume_chan(struct mmp_tdma_chan *tdmac)
@@ -398,7 +398,7 @@ static struct dma_async_tx_descriptor *mmp_tdma_prep_dma_cyclic(
 	int num_periods = buf_len / period_len;
 	int i = 0, buf = 0;
 
-	if (tdmac->status != DMA_SUCCESS)
+	if (tdmac->status != DMA_COMPLETE)
 		return NULL;
 
 	if (period_len > TDMA_MAX_XFER_BYTES) {
@@ -532,7 +532,7 @@ static int mmp_tdma_chan_init(struct mmp_tdma_device *tdev,
 	tdmac->idx	   = idx;
 	tdmac->type	   = type;
 	tdmac->reg_base	   = (unsigned long)tdev->base + idx * 4;
-	tdmac->status = DMA_SUCCESS;
+	tdmac->status = DMA_COMPLETE;
 	tdev->tdmac[tdmac->idx] = tdmac;
 	tasklet_init(&tdmac->tasklet, dma_do_tasklet, (unsigned long)tdmac);
 
Signature · 1 line
1.7.0.4
author
#43 lore raw

PATCH 17/28 dmaengine: mv_xor: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/mv_xor.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/dma/mv_xor.c +3 -3
index 536dcb8..8d5bce9 100644
@@ -749,7 +749,7 @@ static enum dma_status mv_xor_status(struct dma_chan *chan,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS) {
+	if (ret == DMA_COMPLETE) {
 		mv_xor_clean_completed_slots(mv_chan);
 		return ret;
 	}
@@ -874,7 +874,7 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
 	msleep(1);
 
 	if (mv_xor_status(dma_chan, cookie, NULL) !=
-	    DMA_SUCCESS) {
+	    DMA_COMPLETE) {
 		dev_err(dma_chan->device->dev,
 			"Self-test copy timed out, disabling\n");
 		err = -ENODEV;
@@ -968,7 +968,7 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
 	msleep(8);
 
 	if (mv_xor_status(dma_chan, cookie, NULL) !=
-	    DMA_SUCCESS) {
+	    DMA_COMPLETE) {
 		dev_err(dma_chan->device->dev,
 			"Self-test xor timed out, disabling\n");
 		err = -ENODEV;
Signature · 1 line
1.7.0.4
author
#44 lore raw

PATCH 18/28 dmaengine: mxs-dma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/mxs-dma.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/dma/mxs-dma.c +3 -3
index ccd13df..7ab7cec 100644
@@ -224,7 +224,7 @@ static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
 
 static void mxs_dma_disable_chan(struct mxs_dma_chan *mxs_chan)
 {
-	mxs_chan->status = DMA_SUCCESS;
+	mxs_chan->status = DMA_COMPLETE;
 }
 
 static void mxs_dma_pause_chan(struct mxs_dma_chan *mxs_chan)
@@ -312,12 +312,12 @@ static irqreturn_t mxs_dma_int_handler(int irq, void *dev_id)
 			if (mxs_chan->flags & MXS_DMA_SG_LOOP)
 				mxs_chan->status = DMA_IN_PROGRESS;
 			else
-				mxs_chan->status = DMA_SUCCESS;
+				mxs_chan->status = DMA_COMPLETE;
 		}
 
 		stat1 &= ~(1 << channel);
 
-		if (mxs_chan->status == DMA_SUCCESS)
+		if (mxs_chan->status == DMA_COMPLETE)
 			dma_cookie_complete(&mxs_chan->desc);
 
 		/* schedule tasklet on this channel */
Signature · 1 line
1.7.0.4
author
#45 lore raw

PATCH 19/28 dmaengine: omap: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/omap-dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/omap-dma.c +1 -1
index ec3fc4f..2f66cf4 100644
@@ -248,7 +248,7 @@ static enum dma_status omap_dma_tx_status(struct dma_chan *chan,
 	unsigned long flags;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS || !txstate)
+	if (ret == DMA_COMPLETE || !txstate)
 		return ret;
 
 	spin_lock_irqsave(&c->vc.lock, flags);
Signature · 1 line
1.7.0.4
author
#46 lore raw

PATCH 20/28 dmaengine: ppc4xx: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Anatolij Gustschin <[email protected]>
---
 drivers/dma/ppc4xx/adma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/ppc4xx/adma.c +1 -1
index 370ff82..60e02ae 100644
@@ -3891,7 +3891,7 @@ static enum dma_status ppc440spe_adma_tx_status(struct dma_chan *chan,
 
 	ppc440spe_chan = to_ppc440spe_adma_chan(chan);
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	ppc440spe_adma_slot_cleanup(ppc440spe_chan);
Signature · 1 line
1.7.0.4
author
#47 lore raw

PATCH 21/28 dmaengine: sa11x0: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/sa11x0-dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/sa11x0-dma.c +1 -1
index 461a91a..ab26d46 100644
@@ -436,7 +436,7 @@ static enum dma_status sa11x0_dma_tx_status(struct dma_chan *chan,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(&c->vc.chan, cookie, state);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	if (!state)
Signature · 1 line
1.7.0.4
author
#48 lore raw

PATCH 22/28 dmaengine: sh: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Guennadi Liakhovetski <[email protected]>
---
 drivers/dma/sh/shdma-base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/sh/shdma-base.c +1 -1
index d94ab59..2e7b394 100644
@@ -724,7 +724,7 @@ static enum dma_status shdma_tx_status(struct dma_chan *chan,
 	 * If we don't find cookie on the queue, it has been aborted and we have
 	 * to report error
 	 */
-	if (status != DMA_SUCCESS) {
+	if (status != DMA_COMPLETE) {
 		struct shdma_desc *sdesc;
 		status = DMA_ERROR;
 		list_for_each_entry(sdesc, &schan->ld_queue, node)
Signature · 1 line
1.7.0.4
author
#49 lore raw

PATCH 23/28 dmaengine: ste: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Linus Walleij <[email protected]>
---
 drivers/dma/ste_dma40.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/ste_dma40.c +1 -1
index 3d5e4ee..b8c031b 100644
@@ -2627,7 +2627,7 @@ static enum dma_status d40_tx_status(struct dma_chan *chan,
 	}
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret != DMA_SUCCESS)
+	if (ret != DMA_COMPLETE)
 		dma_set_residue(txstate, stedma40_residue(chan));
 
 	if (d40_is_paused(d40c))
Signature · 1 line
1.7.0.4
author
#50 lore raw

PATCH 24/28 dmaengine: tegra: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Stephen Warren <[email protected]>
---
 drivers/dma/tegra20-apb-dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/tegra20-apb-dma.c +2 -2
index 67a6752..73654e3 100644
@@ -570,7 +570,7 @@ static void handle_once_dma_done(struct tegra_dma_channel *tdc,
 
 	list_del(&sgreq->node);
 	if (sgreq->last_sg) {
-		dma_desc->dma_status = DMA_SUCCESS;
+		dma_desc->dma_status = DMA_COMPLETE;
 		dma_cookie_complete(&dma_desc->txd);
 		if (!dma_desc->cb_count)
 			list_add_tail(&dma_desc->cb_node, &tdc->cb_desc);
@@ -768,7 +768,7 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,
 	unsigned int residual;
 
 	ret = dma_cookie_status(dc, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
 		return ret;
 
 	spin_lock_irqsave(&tdc->lock, flags);
Signature · 1 line
1.7.0.4
author
#51 lore raw

PATCH 25/28 dmaengine: txx9: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 drivers/dma/txx9dmac.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/txx9dmac.c +2 -2
index 71e8e77..c2829b4 100644
@@ -962,8 +962,8 @@ txx9dmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
 	enum dma_status ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
-		return DMA_SUCCESS;
+	if (ret == DMA_COMPLETE)
+		return DMA_COMPLETE;
 
 	spin_lock_bh(&dc->lock);
 	txx9dmac_scan_descriptors(dc);
Signature · 1 line
1.7.0.4
author
#52 lore raw

PATCH 26/28 async_tx: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
---
 crypto/async_tx/async_tx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
crypto/async_tx/async_tx.c +2 -2
index 7be3424..39ea479 100644
@@ -128,7 +128,7 @@ async_tx_channel_switch(struct dma_async_tx_descriptor *depend_tx,
 		}
 		device->device_issue_pending(chan);
 	} else {
-		if (dma_wait_for_async_tx(depend_tx) != DMA_SUCCESS)
+		if (dma_wait_for_async_tx(depend_tx) != DMA_COMPLETE)
 			panic("%s: DMA error waiting for depend_tx\n",
 			      __func__);
 		tx->tx_submit(tx);
@@ -280,7 +280,7 @@ void async_tx_quiesce(struct dma_async_tx_descriptor **tx)
 		 * we are referring to the correct operation
 		 */
 		BUG_ON(async_tx_test_ack(*tx));
-		if (dma_wait_for_async_tx(*tx) != DMA_SUCCESS)
+		if (dma_wait_for_async_tx(*tx) != DMA_COMPLETE)
 			panic("%s: DMA error waiting for transaction\n",
 			      __func__);
 		async_tx_ack(*tx);
Signature · 1 line
1.7.0.4
author
#53 lore raw

PATCH 27/28 serial: sh: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC Greg Kroah-Hartman <[email protected]>

---
Greg, pls ack this as it has depedency on my tree

 drivers/tty/serial/sh-sci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/sh-sci.c +1 -1
index 5377502..7d8103c 100644
@@ -1433,7 +1433,7 @@ static void work_fn_rx(struct work_struct *work)
 	desc = s->desc_rx[new];
 
 	if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) !=
-	    DMA_SUCCESS) {
+	    DMA_COMPLETE) {
 		/* Handle incomplete DMA receive */
 		struct dma_chan *chan = s->chan_rx;
 		struct shdma_desc *sh_desc = container_of(desc,
Signature · 1 line
1.7.0.4
author
#55 lore raw

PATCH 28/28 net: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
CC "David S. Miller" <[email protected]>

---
David pls ack this as it has dependency on my tree

 net/ipv4/tcp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +2 -2
index 6e5617b..d2652fb 100644
@@ -1429,7 +1429,7 @@ static void tcp_service_net_dma(struct sock *sk, bool wait)
 	do {
 		if (dma_async_is_tx_complete(tp->ucopy.dma_chan,
 					      last_issued, &done,
-					      &used) == DMA_SUCCESS) {
+					      &used) == DMA_COMPLETE) {
 			/* Safe to free early-copied skbs now */
 			__skb_queue_purge(&sk->sk_async_wait_queue);
 			break;
@@ -1437,7 +1437,7 @@ static void tcp_service_net_dma(struct sock *sk, bool wait)
 			struct sk_buff *skb;
 			while ((skb = skb_peek(&sk->sk_async_wait_queue)) &&
 			       (dma_async_is_complete(skb->dma_cookie, done,
-						      used) == DMA_SUCCESS)) {
+						      used) == DMA_COMPLETE)) {
 				__skb_dequeue(&sk->sk_async_wait_queue);
 				kfree_skb(skb);
 			}
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul

Hi Vinod,

Quoted 33 lines · Vinod Koul

the DMA_SUCCESS is a misnomer as dmaengine indicates the transfer is complete and gives no guarantee of the transfer success. Hence we should use DMA_COMPLTE instead of DMA_SUCCESS

---
 drivers/dma/dmaengine.c   |    2 +-
 include/linux/dmaengine.h |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/dma/dmaengine.c +1 -1
index 9162ac8..81d8765 100644
@@ -1062,7 +1062,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 	unsigned long dma_sync_wait_timeout = jiffies + msecs_to_jiffies(5000);
 
 	if (!tx)
-		return DMA_SUCCESS;
+		return DMA_COMPLETE;
 
 	while (tx->cookie == -EBUSY) {
 		if (time_after_eq(jiffies, dma_sync_wait_timeout)) {
include/linux/dmaengine.h +1 -1
index 0bc7275..4b460a6 100644
@@ -45,13 +45,13 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed

include/linux/dmaengine.h static inline int dma_submit_error(dma_cookie_t cookie) · line 57

Quoted 10 lines
include/linux/dmaengine.h +1 -1
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,

Doesn't this break kernel compilation for a total of 27 commits? Or am I missing anything?

Thanks
Guennadi

Quoted 30 lines
include/linux/dmaengine.h +4 -4
@@ -979,10 +979,10 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
 {
 	if (last_complete <= last_used) {
 		if ((cookie <= last_complete) || (cookie > last_used))
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;
 	} else {
 		if ((cookie <= last_complete) && (cookie > last_used))
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;
 	}
 	return DMA_IN_PROGRESS;
 }
@@ -1013,11 +1013,11 @@ static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_typ
 }
 static inline enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
 {
-	return DMA_SUCCESS;
+	return DMA_COMPLETE;
 }
 static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 {
-	return DMA_SUCCESS;
+	return DMA_COMPLETE;
 }
 static inline void dma_issue_pending_all(void)
 {
Signature · 1 line
1.7.0.4

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#3 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Quoted 42 lines · Guennadi Liakhovetski

Hi Vinod,

Quoted 38 lines · Vinod Koul

the DMA_SUCCESS is a misnomer as dmaengine indicates the transfer is complete and gives no guarantee of the transfer success. Hence we should use DMA_COMPLTE instead of DMA_SUCCESS

---
 drivers/dma/dmaengine.c   |    2 +-
 include/linux/dmaengine.h |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/dma/dmaengine.c +1 -1
index 9162ac8..81d8765 100644
@@ -1062,7 +1062,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
      unsigned long dma_sync_wait_timeout = jiffies + msecs_to_jiffies(5000);
 
      if (!tx)
-             return DMA_SUCCESS;
+             return DMA_COMPLETE;
 
      while (tx->cookie == -EBUSY) {
              if (time_after_eq(jiffies, dma_sync_wait_timeout)) {
include/linux/dmaengine.h +1 -1
index 0bc7275..4b460a6 100644
@@ -45,13 +45,13 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
Quoted 8 lines

include/linux/dmaengine.h static inline int dma_submit_error(dma_cookie_t cookie) · line 57

Quoted 5 lines
include/linux/dmaengine.h +1 -1
-     DMA_SUCCESS,
+     DMA_COMPLETE,
      DMA_IN_PROGRESS,
      DMA_PAUSED,
      DMA_ERROR,

Doesn't this break kernel compilation for a total of 27 commits? Or am I missing anything?

Yes, I think at the start DMA_COMPLETE should just be a alias for DMA_SUCCESS, then after all the driver renames are in delete DMA_SUCCESS.

Tested-by on v1 9/28
#33 lore raw

Re: [PATCH 09/28] dmaengine: edma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 2 lines · Vinod Koul
CC Joel Fernandes <[email protected]>

The audio davinci-pcm driver once converted to dmaengine usage would be the first user of tx_status so I will get to testing this patch better then.

Anyway, with this patch applied I compile-tested and boot-tested it and it doesn't appear to break anything.

thanks,

-Joel

author
#4 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Dan Williams
Quoted 8 lines · Dan Williams

On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski

Quoted 3 lines

Doesn't this break kernel compilation for a total of 27 commits? Or am I missing anything?

Yes, I think at the start DMA_COMPLETE should just be a alias for DMA_SUCCESS, then after all the driver renames are in delete DMA_SUCCESS.

Oops, taht was bad of me. ffixes in v2 and sending patch 29 for removal case

--

Quoted 1 line

From 7768309422a1345d32857974fe8b57805adfd561 Mon Sep 17 00:00:00 2001

From: Vinod Koul <[email protected]>
Date: Wed, 16 Oct 2013 13:29:02 +0530
Subject: [PATCH] dmaengine: use DMA_COMPLETE for dma completion status

the DMA_SUCCESS is a misnomer as dmaengine indicates the transfer is complete and gives no guarantee of the transfer success. Hence we should use DMA_COMPLTE instead of DMA_SUCCESS

---
 drivers/dma/dmaengine.c   |    2 +-
 include/linux/dmaengine.h |   13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/dma/dmaengine.c +1 -1
index 9162ac8..81d8765 100644
@@ -1062,7 +1062,7 @@ dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 	unsigned long dma_sync_wait_timeout = jiffies + msecs_to_jiffies(5000);
 
 	if (!tx)
-		return DMA_SUCCESS;
+		return DMA_COMPLETE;
 
 	while (tx->cookie == -EBUSY) {
 		if (time_after_eq(jiffies, dma_sync_wait_timeout)) {
include/linux/dmaengine.h +7 -6
index 0bc7275..683c380 100644
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };
 
 /**
@@ -979,10 +980,10 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
 {
 	if (last_complete <= last_used) {
 		if ((cookie <= last_complete) || (cookie > last_used))
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;
 	} else {
 		if ((cookie <= last_complete) && (cookie > last_used))
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;
 	}
 	return DMA_IN_PROGRESS;
 }
@@ -1013,11 +1014,11 @@ static inline struct dma_chan *dma_find_channel(enum dma_transaction_type tx_typ
 }
 static inline enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
 {
-	return DMA_SUCCESS;
+	return DMA_COMPLETE;
 }
 static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
 {
-	return DMA_SUCCESS;
+	return DMA_COMPLETE;
 }
 static inline void dma_issue_pending_all(void)
 {
Signature · 3 lines
1.7.0.4

-- 
author
#56 lore raw

PATCH 29/29 dmaengine: remove unused DMA_SUCCESS

In reply to Vinod Koul

after all the users are converted

---
 include/linux/dmaengine.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
include/linux/dmaengine.h +0 -1
index 683c380..4b460a6 100644
@@ -55,7 +55,6 @@ enum dma_status {
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
-	DMA_SUCCESS,
 };
 
 /**
Signature · 1 line
1.7.0.4
Acked-by on v1 3/28
#24 lore raw

Re: [PATCH 03/28] dmaengine: at_hdma: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul

On 16/10/2013 18:28, Vinod Koul :

Quoted 2 lines
CC Nicolas Ferre <[email protected]>
Quoted 18 lines
---
  drivers/dma/at_hdmac.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
drivers/dma/at_hdmac.c +1 -1
index c787f38..1ef7457 100644
@@ -1102,7 +1102,7 @@ atc_tx_status(struct dma_chan *chan,
  	int bytes = 0;
 
  	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)
  		return ret;
  	/*
  	 * There's no point calculating the residue if there's
Signature · 1 line
Nicolas Ferre
#5 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 10 lines · Vinod Koul
Quoted 8 lines · Dan Williams

On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski

Quoted 3 lines

Doesn't this break kernel compilation for a total of 27 commits? Or am I missing anything?

Yes, I think at the start DMA_COMPLETE should just be a alias for DMA_SUCCESS, then after all the driver renames are in delete DMA_SUCCESS.

Oops, taht was bad of me. ffixes in v2 and sending patch 29 for removal case

Ok, yes, this should work now. I'm wondering though - is DMA_COMPLTE really a better name? AFAICS, we can only differentiate between 2 possibilities with the current API: a transfer is "in progress" - between last used and last completed, and "unknown" - either completed, or aborted, or not yet submitted - if the cookie is larger, than last completed and we assume, that it has wrapped.

Actually for a driver, that I'm currently working on, I implemented a cache of N last cookies (e.g. 128), which is a bitfield, where I just record a 1, if that descriptor has failed, and a 0, if completed successfully. That way I can report one of 4 states: cookie on queue, completed successfully, failed, unknown. I'm not sure, whether I'll keep this in the final version, this doesn't really fit the present dmaengine API concept. We could make this generic, if desired. Otherwise your proposed error callback should help too. But in either case I think with the current implementation we cannot find out whether a specific cookie completed successfully or failed.

One more observation: I looked at a couple of drivers, using the DMA_ERROR state. E.g. mmp_tdma.c, mxs-dma.c. They store errors in a .status field in their private data. Then they return that status in their .device_tx_status() methods - independent on the cookie! This doesn't look right to me... at_hdmac.c does something similarly strange.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Acked-by on the v1 series
#58 lore raw
In reply to Vinod Koul
Quoted 6 lines · Vinod Koul

As we recently discussed in [1], the DMA_SUCCESS is an misnomer. The dmaengine does not acknowledge that dma completed succesfully. It can only signal dma was completed by it. Hence we should use DMA_COMPLTE as status instead of DMA_SUCCESS

[1]: http://www.spinics.net/lists/arm-kernel/msg278346.html

This make things more clear. The series:

Yours,
Linus Walleij

author
#6 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Guennadi Liakhovetski
Quoted 11 lines · Guennadi Liakhovetski
Quoted 9 lines · Vinod Koul
Quoted 8 lines · Dan Williams

On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski

Quoted 3 lines

Doesn't this break kernel compilation for a total of 27 commits? Or am I missing anything?

Yes, I think at the start DMA_COMPLETE should just be a alias for DMA_SUCCESS, then after all the driver renames are in delete DMA_SUCCESS.

Quoted 8 lines
Quoted 1 line

Oops, taht was bad of me. ffixes in v2 and sending patch 29 for removal case

Ok, yes, this should work now. I'm wondering though - is DMA_COMPLTE really a better name? AFAICS, we can only differentiate between 2 possibilities with the current API: a transfer is "in progress" - between last used and last completed, and "unknown" - either completed, or aborted, or not yet submitted - if the cookie is larger, than last completed and we assume, that it has wrapped.

well, once you submit N, and chekcing status, if you get last > N, then you assume it completed. If last is M then M is completed and M + 1 running and rest in queue. You know which one is last submitted in client

Quoted 10 lines

Actually for a driver, that I'm currently working on, I implemented a cache of N last cookies (e.g. 128), which is a bitfield, where I just record a 1, if that descriptor has failed, and a 0, if completed successfully. That way I can report one of 4 states: cookie on queue, completed successfully, failed, unknown. I'm not sure, whether I'll keep this in the final version, this doesn't really fit the present dmaengine API concept. We could make this generic, if desired. Otherwise your proposed error callback should help too. But in either case I think with the current implementation we cannot find out whether a specific cookie completed successfully or failed.

The propsed error callback will tell you if dmaengine detected a failure or not. That should with above cover well

Quoted 5 lines

One more observation: I looked at a couple of drivers, using the DMA_ERROR state. E.g. mmp_tdma.c, mxs-dma.c. They store errors in a .status field in their private data. Then they return that status in their .device_tx_status() methods - independent on the cookie! This doesn't look right to me... at_hdmac.c does something similarly strange.

Yup bunch of ones arent being good citizens..

~Vinod

reviewer Acked-by on v1 8/28
#30 lore raw

Re: [PATCH 08/28] dmaengine: dw: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 17 lines · Vinod Koul
CC Andy Shevchenko <[email protected]>
CC Viresh Kumar <[email protected]>
---
 drivers/dma/dw/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dw/core.c +1 -1
index 89eb89f..2c29331 100644
@@ -1098,13 +1098,13 @@ dwc_tx_status(struct dma_chan *chan,
 	enum dma_status		ret;
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret == DMA_SUCCESS)
+	if (ret == DMA_COMPLETE)

drivers/dma/dw/core.c dwc_tx_status(struct dma_chan *chan, · line 1110

Quoted 10 lines
drivers/dma/dw/core.c +1 -1
 		return ret;
 
 	dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
 
 	ret = dma_cookie_status(chan, cookie, txstate);
-	if (ret != DMA_SUCCESS)
+	if (ret != DMA_COMPLETE)
 		dma_set_residue(txstate, dwc_get_residue(dwc));
 
 	if (dwc->paused && ret == DMA_IN_PROGRESS)
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
author
#8 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Sebastian Andrzej Siewior
Quoted 33 lines · Sebastian Andrzej Siewior
Quoted 11 lines · Vinod Koul

index 0bc7275..683c380 100644

include/linux/dmaengine.h +1 -1
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused

include/linux/dmaengine.h static inline int dma_submit_error(dma_cookie_t cookie) · line 59

Quoted 10 lines
include/linux/dmaengine.h +2 -1
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };

There are some drivers which compare against == or != DMA_SUCCESS. Shouldn't this become
enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
};

Quoted 1 line

so nothing breaks during the transition?

Yes i missed it in first place update the patch to fix that

~Vinod

#7 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 11 lines · Vinod Koul

index 0bc7275..683c380 100644

include/linux/dmaengine.h +1 -1
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused

include/linux/dmaengine.h static inline int dma_submit_error(dma_cookie_t cookie) · line 59

Quoted 10 lines
include/linux/dmaengine.h +2 -1
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };

There are some drivers which compare against == or != DMA_SUCCESS. Shouldn't this become
enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
};

so nothing breaks during the transition?

Sebastian

#21 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Hi Sebastian

Quoted 33 lines · Sebastian Andrzej Siewior
Quoted 11 lines · Vinod Koul

index 0bc7275..683c380 100644

include/linux/dmaengine.h +1 -1
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused

include/linux/dmaengine.h static inline int dma_submit_error(dma_cookie_t cookie) · line 59

Quoted 10 lines
include/linux/dmaengine.h +2 -1
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };

There are some drivers which compare against == or != DMA_SUCCESS. Shouldn't this become
enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
};

Quoted 1 line

so nothing breaks during the transition?

Good catch. I would do

enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE,
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
};

+ #define DMA_SUCCESS DMA_COMPLETE

and then just remove the last line again

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Acked-by on v1 8/28
#31 lore raw

Re: [PATCH 08/28] dmaengine: dw: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 17 lines · Vinod Koul
CC Andy Shevchenko <[email protected]>
CC Viresh Kumar <[email protected]>
---
 drivers/dma/dw/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dma/dw/core.c +1 -1
index 89eb89f..2c29331 100644
@@ -1098,13 +1098,13 @@ dwc_tx_status(struct dma_chan *chan,
        enum dma_status         ret;
 
        ret = dma_cookie_status(chan, cookie, txstate);
-       if (ret == DMA_SUCCESS)
+       if (ret == DMA_COMPLETE)

drivers/dma/dw/core.c dwc_tx_status(struct dma_chan *chan, · line 1110

Quoted 10 lines
drivers/dma/dw/core.c +1 -1
                return ret;
 
        dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
 
        ret = dma_cookie_status(chan, cookie, txstate);
-       if (ret != DMA_SUCCESS)
+       if (ret != DMA_COMPLETE)
                dma_set_residue(txstate, dwc_get_residue(dwc));
 
        if (dwc->paused && ret == DMA_IN_PROGRESS)
#9 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul

Hi Vinod

Quoted 34 lines · Vinod Koul
Quoted 33 lines · Sebastian Andrzej Siewior
Quoted 11 lines · Vinod Koul

index 0bc7275..683c380 100644

include/linux/dmaengine.h +1 -1
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused

include/linux/dmaengine.h static inline int dma_submit_error(dma_cookie_t cookie) · line 59

Quoted 10 lines
include/linux/dmaengine.h +2 -1
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };

There are some drivers which compare against == or != DMA_SUCCESS. Shouldn't this become
enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
};

Quoted 2 lines
Quoted 1 line

so nothing breaks during the transition?

Yes i missed it in first place update the patch to fix that

Are you planning to post a fixed version of this patch or you just fix it internally? Would be good to have it posted to be able to ack it and other relevant patches.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

author
#10 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Quoted 8 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 1 line · Vinod Koul

Yes i missed it in first place update the patch to fix that

Are you planning to post a fixed version of this patch or you just fix it internally? Would be good to have it posted to be able to ack it and other relevant patches.

looks like you missed it... I had posted updated patch [1] in this thread here and I posted 29th patch as removal one [2]

Both were pushed to -next after few days

[1]: http://marc.info/?l=linux-kernel&m=138197886521699&w=2
[2]: http://marc.info/?l=linux-kernel&m=138197936321767&w=2

Signature · 1 line
~Vinod
author
#12 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Guennadi Liakhovetski
Quoted 56 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 11 lines · Vinod Koul
Quoted 8 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 1 line · Vinod Koul

Yes i missed it in first place update the patch to fix that

Are you planning to post a fixed version of this patch or you just fix it internally? Would be good to have it posted to be able to ack it and other relevant patches.

looks like you missed it... I had posted updated patch [1] in this thread here and I posted 29th patch as removal one [2]

No, I didn't miss those, but as Sebastian pointed out and as I commented too, also that v2 version wasn't correct, so, a fixed v3 was needed. Consider this:

In patch 1 you do:

include/linux/dmaengine.h +3 -2
index 0bc7275..683c380 100644
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };
 
 /**

and then in a couple of places

include/linux/dmaengine.h +1 -1
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;

So, after that your patch dmaengine would be returning DMA_COMPLETE in case of success, i.e. 0. But all the DMAC and user drivers would still be checking for

Quoted 6 lines
	if (status != DMA_COMPLETE) {

i.e. comparing status with 4 and thus detecting false errors, until your further 28 patches fix them. That's why, as Sebastian pointed out it was important to define DMA_COMPLETE and DMA_SUCCESS with the _same_ numerical value in your patch 1.

Sure, I will fix this up now as suggested

enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,

Thanks for poiting out.

--
~Vinod

#11 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul

Hi Vinod

Quoted 11 lines · Vinod Koul
Quoted 8 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 1 line · Vinod Koul

Yes i missed it in first place update the patch to fix that

Are you planning to post a fixed version of this patch or you just fix it internally? Would be good to have it posted to be able to ack it and other relevant patches.

looks like you missed it... I had posted updated patch [1] in this thread here and I posted 29th patch as removal one [2]

No, I didn't miss those, but as Sebastian pointed out and as I commented too, also that v2 version wasn't correct, so, a fixed v3 was needed. Consider this:

In patch 1 you do:

include/linux/dmaengine.h +3 -2
index 0bc7275..683c380 100644
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };
 
 /**

and then in a couple of places

- return DMA_SUCCESS;
+ return DMA_COMPLETE;

So, after that your patch dmaengine would be returning DMA_COMPLETE in case of success, i.e. 0. But all the DMAC and user drivers would still be checking for

	if (status != DMA_COMPLETE) {

i.e. comparing status with 4 and thus detecting false errors, until your further 28 patches fix them. That's why, as Sebastian pointed out it was important to define DMA_COMPLETE and DMA_SUCCESS with the _same_ numerical value in your patch 1.

Quoted 1 line

Both were pushed to -next after few days

That's a pity, but I still don't see them in upstream -next, so, maybe it's still possible to fix?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#13 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 65 lines · Vinod Koul
Quoted 56 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 11 lines · Vinod Koul
Quoted 8 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 1 line · Vinod Koul

Yes i missed it in first place update the patch to fix that

Are you planning to post a fixed version of this patch or you just fix it internally? Would be good to have it posted to be able to ack it and other relevant patches.

looks like you missed it... I had posted updated patch [1] in this thread here and I posted 29th patch as removal one [2]

No, I didn't miss those, but as Sebastian pointed out and as I commented too, also that v2 version wasn't correct, so, a fixed v3 was needed. Consider this:

In patch 1 you do:

include/linux/dmaengine.h +3 -2
index 0bc7275..683c380 100644
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-	DMA_SUCCESS,
+	DMA_COMPLETE,
 	DMA_IN_PROGRESS,
 	DMA_PAUSED,
 	DMA_ERROR,
+	DMA_SUCCESS,
 };
 
 /**

and then in a couple of places

include/linux/dmaengine.h +1 -1
-			return DMA_SUCCESS;
+			return DMA_COMPLETE;

So, after that your patch dmaengine would be returning DMA_COMPLETE in case of success, i.e. 0. But all the DMAC and user drivers would still be checking for

Quoted 6 lines
	if (status != DMA_COMPLETE) {

i.e. comparing status with 4 and thus detecting false errors, until your further 28 patches fix them. That's why, as Sebastian pointed out it was important to define DMA_COMPLETE and DMA_SUCCESS with the _same_ numerical value in your patch 1.

Sure, I will fix this up now as suggested

Quoted 5 lines

enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,

Thanks for poiting out.

Great! In my reply to Sebastian I proposed an equivlent but slightly different version:

enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE,
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
};

+ #define DMA_SUCCESS DMA_COMPLETE

but it doesn't really matter. Feel free to use whichever version you prefer.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#14 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Hi,

Quoted 86 lines · Guennadi Liakhovetski
Quoted 65 lines · Vinod Koul
Quoted 56 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 11 lines · Vinod Koul
Quoted 8 lines · Guennadi Liakhovetski

Hi Vinod

Quoted 1 line · Vinod Koul

Yes i missed it in first place update the patch to fix that

Are you planning to post a fixed version of this patch or you just fix it internally? Would be good to have it posted to be able to ack it and other relevant patches.

looks like you missed it... I had posted updated patch [1] in this thread here and I posted 29th patch as removal one [2]

No, I didn't miss those, but as Sebastian pointed out and as I commented too, also that v2 version wasn't correct, so, a fixed v3 was needed. Consider this:

In patch 1 you do:

include/linux/dmaengine.h +3 -2
index 0bc7275..683c380 100644
@@ -45,16 +45,17 @@ static inline int dma_submit_error(dma_cookie_t cookie)
 
 /**
  * enum dma_status - DMA transaction status
- * @DMA_SUCCESS: transaction completed successfully
+ * @DMA_COMPLETE: transaction completed
  * @DMA_IN_PROGRESS: transaction not yet processed
  * @DMA_PAUSED: transaction is paused
  * @DMA_ERROR: transaction failed
  */
 enum dma_status {
-   DMA_SUCCESS,
+   DMA_COMPLETE,
    DMA_IN_PROGRESS,
    DMA_PAUSED,
    DMA_ERROR,
+   DMA_SUCCESS,
 };
 
 /**

and then in a couple of places

include/linux/dmaengine.h +1 -1
-                   return DMA_SUCCESS;
+                   return DMA_COMPLETE;

So, after that your patch dmaengine would be returning DMA_COMPLETE in case of success, i.e. 0. But all the DMAC and user drivers would still be checking for

Quoted 6 lines
    if (status != DMA_COMPLETE) {

i.e. comparing status with 4 and thus detecting false errors, until your further 28 patches fix them. That's why, as Sebastian pointed out it was important to define DMA_COMPLETE and DMA_SUCCESS with the _same_ numerical value in your patch 1.

Sure, I will fix this up now as suggested

Quoted 5 lines

enum dma_status {
- DMA_SUCCESS,
+ DMA_COMPLETE = 0, DMA_SUCCESS = 0,

Thanks for poiting out.

Great! In my reply to Sebastian I proposed an equivlent but slightly different version:

enum dma_status {

include/linux/dmaengine.h +2 -1
-       DMA_SUCCESS,
+       DMA_COMPLETE,
        DMA_IN_PROGRESS,
        DMA_PAUSED,
        DMA_ERROR,
 };
 
+ #define DMA_SUCCESS DMA_COMPLETE
Quoted 2 lines

but it doesn't really matter. Feel free to use whichever version you prefer.

This patch broke some TI platforms (using edma) due to namespace conflicts. The error is:

../../include/linux/dmaengine.h:54:2: error: expected identifier
before numeric constant (for DMA_COMPLETE)

.. it's because they define DMA_COMPLETE in include/platform_data/edma.h.

The edma driver seems to overall lack prefixes and thus pollutes global namespaces, so it should be fixed up.

-Olof

author
#15 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Quoted 10 lines · Olof Johansson

This patch broke some TI platforms (using edma) due to namespace conflicts. The error is:

../../include/linux/dmaengine.h:54:2: error: expected identifier
before numeric constant (for DMA_COMPLETE)

.. it's because they define DMA_COMPLETE in include/platform_data/edma.h.

The edma driver seems to overall lack prefixes and thus pollutes global namespaces, so it should be fixed up.

Yup this needs some work.

I fixed up the error with below, can you pls verify. Pls note this is compile tested only!

-----><8---------------------------

From: Vinod Koul <[email protected]>
Date: Wed, 30 Oct 2013 18:22:30 +0530
Subject: [PATCH] dmanengine: fix edma driver to not define DMA_COMPLETE

edma header defines DMA_COMPLETE, this causes issues as commit adfedd9a32e4 move DMA_SUCCESS to DMA_COMPLETE. edma should properly namespace its defines and needs a future fix

---
 arch/arm/common/edma.c             |    4 ++--
 drivers/dma/edma.c                 |    4 ++--
 include/linux/platform_data/edma.h |    8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/common/edma.c +2 -2
index 8e1a024..41bca32 100644
@@ -404,7 +404,7 @@ static irqreturn_t dma_irq_handler(int irq, void *data)
 					BIT(slot));
 			if (edma_cc[ctlr]->intr_data[channel].callback)
 				edma_cc[ctlr]->intr_data[channel].callback(
-					channel, DMA_COMPLETE,
+					channel, EDMA_DMA_COMPLETE,
 					edma_cc[ctlr]->intr_data[channel].data);
 		}
 	} while (sh_ipr);
@@ -459,7 +459,7 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data)
 								callback) {
 						edma_cc[ctlr]->intr_data[k].
 						callback(k,
-						DMA_CC_ERROR,
+						EDMA_DMA_CC_ERROR,
 						edma_cc[ctlr]->intr_data
 						[k].data);
 					}
drivers/dma/edma.c +2 -2
index 29fa358..cb69f3a 100644
@@ -407,7 +407,7 @@ static void edma_callback(unsigned ch_num, u16 ch_status, void *data)
 	edma_pause(echan->ch_num);
 
 	switch (ch_status) {
-	case DMA_COMPLETE:
+	case EDMA_DMA_COMPLETE:
 		spin_lock_irqsave(&echan->vchan.lock, flags);
 
 		edesc = echan->edesc;
@@ -426,7 +426,7 @@ static void edma_callback(unsigned ch_num, u16 ch_status, void *data)
 		spin_unlock_irqrestore(&echan->vchan.lock, flags);
 
 		break;
-	case DMA_CC_ERROR:
+	case EDMA_DMA_CC_ERROR:
 		spin_lock_irqsave(&echan->vchan.lock, flags);
 
 		edma_read_slot(EDMA_CHAN_SLOT(echan->slot[0]), &p);
include/linux/platform_data/edma.h +4 -4
index 179fb91..f50821c 100644
@@ -67,10 +67,10 @@ struct edmacc_param {
 #define ITCCHEN		BIT(23)
 
 /*ch_status paramater of callback function possible values*/
-#define DMA_COMPLETE 1
-#define DMA_CC_ERROR 2
-#define DMA_TC1_ERROR 3
-#define DMA_TC2_ERROR 4
+#define EDMA_DMA_COMPLETE 1
+#define EDMA_DMA_CC_ERROR 2
+#define EDMA_DMA_TC1_ERROR 3
+#define EDMA_DMA_TC2_ERROR 4
 
 enum address_mode {
 	INCR = 0,
Signature · 4 lines
1.7.0.4

--
~Vinod
#16 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Quoted 2 lines · Vinod Koul

I fixed up the error with below, can you pls verify. Pls note this is compile tested only!

I tested this and my mmc driver using edma via drivers/dma seems to work.

However you missed one piece:

CC [M] sound/soc/davinci/davinci-pcm.o
sound/soc/davinci/davinci-pcm.c: In function ?davinci_pcm_dma_irq?:
sound/soc/davinci/davinci-pcm.c:241: error: ?DMA_COMPLETE? undeclared (first use in this function) sound/soc/davinci/davinci-pcm.c:241: error: (Each undeclared identifier is reported only once sound/soc/davinci/davinci-pcm.c:241: error: for each function it appears in.)

---
 sound/soc/davinci/davinci-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/davinci/davinci-pcm.c +1 -1
index 8460edc..e68ba31 100644
@@ -238,7 +238,7 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
 	print_buf_info(prtd->ram_channel, "i ram_channel");
 	pr_debug("davinci_pcm: link=%d, status=0x%x\n", link, ch_status);
 
-	if (unlikely(ch_status != DMA_COMPLETE))
+	if (unlikely(ch_status != EDMA_DMA_COMPLETE))
 		return;
 
 	if (snd_pcm_running(substream)) {
Signature · 3 lines
1.8.4.rc3

Sebastian
#17 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 22 lines · Vinod Koul
Quoted 10 lines · Olof Johansson

This patch broke some TI platforms (using edma) due to namespace conflicts. The error is:

../../include/linux/dmaengine.h:54:2: error: expected identifier
before numeric constant (for DMA_COMPLETE)

.. it's because they define DMA_COMPLETE in include/platform_data/edma.h.

The edma driver seems to overall lack prefixes and thus pollutes global namespaces, so it should be fixed up.

Yup this needs some work.

I fixed up the error with below, can you pls verify. Pls note this is compile tested only!

-----><8---------------------------

From: Vinod Koul <[email protected]>
Date: Wed, 30 Oct 2013 18:22:30 +0530
Subject: [PATCH] dmanengine: fix edma driver to not define DMA_COMPLETE

Quoted 6 lines

edma header defines DMA_COMPLETE, this causes issues as commit adfedd9a32e4 move DMA_SUCCESS to DMA_COMPLETE. edma should properly namespace its defines and needs a future fix

Thanks, I've applied this to fixes together with the follow-up from Sebastian. Cc:ing Mark since it touches drivers/soc.

-Olof

author
#18 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

Quoted 27 lines · Olof Johansson
Quoted 26 lines · Vinod Koul
Quoted 10 lines · Olof Johansson

This patch broke some TI platforms (using edma) due to namespace conflicts. The error is:

../../include/linux/dmaengine.h:54:2: error: expected identifier
before numeric constant (for DMA_COMPLETE)

.. it's because they define DMA_COMPLETE in include/platform_data/edma.h.

The edma driver seems to overall lack prefixes and thus pollutes global namespaces, so it should be fixed up.

Yup this needs some work.

I fixed up the error with below, can you pls verify. Pls note this is compile tested only!

-----><8---------------------------

From: Vinod Koul <[email protected]>
Date: Wed, 30 Oct 2013 18:22:30 +0530
Subject: [PATCH] dmanengine: fix edma driver to not define DMA_COMPLETE

edma header defines DMA_COMPLETE, this causes issues as commit adfedd9a32e4 move DMA_SUCCESS to DMA_COMPLETE. edma should properly namespace its defines and needs a future fix

Quoted 5 lines
Quoted 2 lines

Thanks, I've applied this to fixes together with the follow-up from Sebastian. Cc:ing Mark since it touches drivers/soc.

I had applied this a while back and pushed only thing remaining was Sebastian's patch. Since this is dependent on the series I am sending to Linus in a day ro two, would prefer things to go thru this tree only.

Let me know if you are okay and will apply Sebastian fix on my next

--
~Vinod

author
#20 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Olof Johansson
Quoted 38 lines · Olof Johansson
Quoted 37 lines · Vinod Koul
Quoted 27 lines · Olof Johansson
Quoted 26 lines · Vinod Koul
Quoted 10 lines · Olof Johansson

This patch broke some TI platforms (using edma) due to namespace conflicts. The error is:

../../include/linux/dmaengine.h:54:2: error: expected identifier
before numeric constant (for DMA_COMPLETE)

.. it's because they define DMA_COMPLETE in include/platform_data/edma.h.

The edma driver seems to overall lack prefixes and thus pollutes global namespaces, so it should be fixed up.

Yup this needs some work.

I fixed up the error with below, can you pls verify. Pls note this is compile tested only!

-----><8---------------------------

From: Vinod Koul <[email protected]>
Date: Wed, 30 Oct 2013 18:22:30 +0530
Subject: [PATCH] dmanengine: fix edma driver to not define DMA_COMPLETE

edma header defines DMA_COMPLETE, this causes issues as commit adfedd9a32e4 move DMA_SUCCESS to DMA_COMPLETE. edma should properly namespace its defines and needs a future fix

Quoted 5 lines
Quoted 2 lines

Thanks, I've applied this to fixes together with the follow-up from Sebastian. Cc:ing Mark since it touches drivers/soc.

I had applied this a while back and pushed only thing remaining was Sebastian's patch. Since this is dependent on the series I am sending to Linus in a day ro two, would prefer things to go thru this tree only.

Quoted 5 lines
Quoted 1 line

Let me know if you are okay and will apply Sebastian fix on my next

Ah, go ahead -- I thought it hadn't been picked up yet since there were still failures (i.e. due to Sebastian's fixes). Feel free to add my Acked-by where you still can. :-)

Sure, applied this one

Quoted 3 lines

I have a couple of small fixes to take care of warnings with LPAE configs that I hope to get out tonight or tomorrow morning, it'd be nice to see them go in too (just printk format warning fixes).

Sure, I will hold off for few more days for more coverage. Also if you/Sebastian can check more if anything still breaks and we fix it before sending would be good too

--
~Vinod

#19 lore raw

Re: [PATCH 01/28] dmaengine: use DMA_COMPLETE for dma completion status

In reply to Vinod Koul
Quoted 31 lines · Vinod Koul
Quoted 30 lines · Olof Johansson
Quoted 28 lines · Vinod Koul
Quoted 10 lines · Olof Johansson

This patch broke some TI platforms (using edma) due to namespace conflicts. The error is:

../../include/linux/dmaengine.h:54:2: error: expected identifier
before numeric constant (for DMA_COMPLETE)

.. it's because they define DMA_COMPLETE in include/platform_data/edma.h.

The edma driver seems to overall lack prefixes and thus pollutes global namespaces, so it should be fixed up.

Yup this needs some work.

I fixed up the error with below, can you pls verify. Pls note this is compile tested only!

-----><8---------------------------

From: Vinod Koul <[email protected]>
Date: Wed, 30 Oct 2013 18:22:30 +0530
Subject: [PATCH] dmanengine: fix edma driver to not define DMA_COMPLETE

edma header defines DMA_COMPLETE, this causes issues as commit adfedd9a32e4 move DMA_SUCCESS to DMA_COMPLETE. edma should properly namespace its defines and needs a future fix

Quoted 7 lines
Quoted 2 lines

Thanks, I've applied this to fixes together with the follow-up from Sebastian. Cc:ing Mark since it touches drivers/soc.

I had applied this a while back and pushed only thing remaining was Sebastian's patch. Since this is dependent on the series I am sending to Linus in a day ro two, would prefer things to go thru this tree only.

Let me know if you are okay and will apply Sebastian fix on my next

Ah, go ahead -- I thought it hadn't been picked up yet since there were still failures (i.e. due to Sebastian's fixes). Feel free to add my Acked-by where you still can. :-)

I have a couple of small fixes to take care of warnings with LPAE configs that I hope to get out tonight or tomorrow morning, it'd be nice to see them go in too (just printk format warning fixes).

-Olof