2013-10-16 17:30:17

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 00/28]: 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


2013-10-16 17:22:14

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 01/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

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/dmaengine.c | 2 +-
include/linux/dmaengine.h | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 9162ac8..81d8765 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -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)) {
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 0bc7275..4b460a6 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -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)
{
--
1.7.0.4

2013-10-16 17:22:24

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 03/28] dmaengine: at_hdma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Nicolas Ferre <[email protected]>
---
drivers/dma/at_hdmac.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index c787f38..1ef7457 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -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
--
1.7.0.4

2013-10-16 17:22:21

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 04/28] dmaengine: coh901318: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Linus Walleij <[email protected]>
---
drivers/dma/coh901318.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 3025b91..3c6716e 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -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));
--
1.7.0.4

2013-10-16 17:22:49

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 08/28] dmaengine: dw: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Andy Shevchenko <[email protected]>
CC: Viresh Kumar <[email protected]>
---
drivers/dma/dw/core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 89eb89f..2c29331 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -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)
--
1.7.0.4

2013-10-16 17:22:56

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 11/28] dmaengine: imx-sdma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Acked-by: Shawn Guo <[email protected]>
---
drivers/dma/imx-sdma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index fc43603..0e03b31 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -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)
--
1.7.0.4

2013-10-16 17:23:01

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 10/28] dmaengine: imx-dma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Sascha Hauer <[email protected]>
---
drivers/dma/imx-dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 55852c0..2af4028 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -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++;
--
1.7.0.4

2013-10-16 17:23:31

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 27/28] serial: sh: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
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(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 5377502..7d8103c 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -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,
--
1.7.0.4

2013-10-16 17:23:30

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 17/28] dmaengine: mv_xor: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/mv_xor.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 536dcb8..8d5bce9 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -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;
--
1.7.0.4

2013-10-16 17:23:46

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 28/28] net: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
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(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6e5617b..d2652fb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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);
}
--
1.7.0.4

2013-10-16 17:23:28

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 18/28] dmaengine: mxs-dma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Shawn Guo <[email protected]>
---
drivers/dma/mxs-dma.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index ccd13df..7ab7cec 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -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 */
--
1.7.0.4

2013-10-16 17:24:30

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 26/28] async_tx: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
crypto/async_tx/async_tx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c
index 7be3424..39ea479 100644
--- a/crypto/async_tx/async_tx.c
+++ b/crypto/async_tx/async_tx.c
@@ -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);
--
1.7.0.4

2013-10-16 17:23:26

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 15/28] dmaengine: k3dma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Zhangfei Gao <[email protected]>
---
drivers/dma/k3dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index da43062..e260754 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -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);
--
1.7.0.4

2013-10-16 17:24:57

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 24/28] dmaengine: tegra: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Stephen Warren <[email protected]>
---
drivers/dma/tegra20-apb-dma.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 67a6752..73654e3 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -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);
--
1.7.0.4

2013-10-16 17:24:55

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 25/28] dmaengine: txx9: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/txx9dmac.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index 71e8e77..c2829b4 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -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);
--
1.7.0.4

2013-10-16 17:25:46

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 23/28] dmaengine: ste: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Linus Walleij <[email protected]>
---
drivers/dma/ste_dma40.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 3d5e4ee..b8c031b 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -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))
--
1.7.0.4

2013-10-16 17:25:59

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 22/28] dmaengine: sh: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Guennadi Liakhovetski <[email protected]>
---
drivers/dma/sh/shdma-base.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index d94ab59..2e7b394 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -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)
--
1.7.0.4

2013-10-16 17:23:24

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 16/28] dmaengine: mmp_tdma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Zhangfei Gao <[email protected]>
---
drivers/dma/mmp_tdma.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index 8f3e865..2b4026d 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -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);

--
1.7.0.4

2013-10-16 17:26:30

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 21/28] dmaengine: sa11x0: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/sa11x0-dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c
index 461a91a..ab26d46 100644
--- a/drivers/dma/sa11x0-dma.c
+++ b/drivers/dma/sa11x0-dma.c
@@ -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)
--
1.7.0.4

2013-10-16 17:26:28

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 20/28] dmaengine: ppc4xx: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Anatolij Gustschin <[email protected]>
---
drivers/dma/ppc4xx/adma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 370ff82..60e02ae 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -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);
--
1.7.0.4

2013-10-16 17:26:57

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 19/28] dmaengine: omap: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/omap-dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index ec3fc4f..2f66cf4 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -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);
--
1.7.0.4

2013-10-16 17:23:00

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 12/28] dmaengine: intel_mid_dma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/intel_mid_dma.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c
index a975ebe..1aab813 100644
--- a/drivers/dma/intel_mid_dma.c
+++ b/drivers/dma/intel_mid_dma.c
@@ -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);
--
1.7.0.4

2013-10-16 17:22:58

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 13/28] dmaengine: ioat: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Dave Jiang <[email protected]>
---
drivers/dma/ioat/dma.c | 4 ++--
drivers/dma/ioat/dma_v3.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 5ff6fc1..a0f0fce 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -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;
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index d8ececa..806b4ce 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -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;
--
1.7.0.4

2013-10-16 17:22:55

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 14/28] dmaengine: iop: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/iop-adma.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index dd8b44a..408fe6b 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -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;
--
1.7.0.4

2013-10-16 17:28:30

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 09/28] dmaengine: edma: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Joel Fernandes <[email protected]>
---
drivers/dma/edma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 098a8da..29fa358 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -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);
--
1.7.0.4

2013-10-16 17:22:48

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 07/28] dmaengine: dmatest: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/dmatest.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 92f796c..59e287f 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -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,
--
1.7.0.4

2013-10-16 17:22:19

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 05/28] dmaengine: cppi41: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Sebastian Andrzej Siewior <[email protected]>
---
drivers/dma/cppi41.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 167c022..278b305 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -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 */

--
1.7.0.4

2013-10-16 17:29:14

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 06/28] dmaengine: jz4740: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Lars-Peter Clausen <[email protected]>
---
drivers/dma/dma-jz4740.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c
index b0c0c82..94c380f 100644
--- a/drivers/dma/dma-jz4740.c
+++ b/drivers/dma/dma-jz4740.c
@@ -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);
--
1.7.0.4

2013-10-16 17:29:34

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 02/28] dmaengine: amba-pl08x: use DMA_COMPLETE for dma completion status

Signed-off-by: Vinod Koul <[email protected]>
CC: Linus Walleij <[email protected]>
---
drivers/dma/amba-pl08x.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 9b50257..4ee6533 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -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 */
--
1.7.0.4

2013-10-16 18:30:40

by Guennadi Liakhovetski

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

Hi Vinod,

On Wed, 16 Oct 2013, Vinod Koul wrote:

> 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
>
> Signed-off-by: Vinod Koul <[email protected]>
> ---
> drivers/dma/dmaengine.c | 2 +-
> include/linux/dmaengine.h | 12 ++++++------
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 9162ac8..81d8765 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -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)) {
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 0bc7275..4b460a6 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -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,

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

Thanks
Guennadi

> @@ -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)
> {
> --
> 1.7.0.4
>

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

2013-10-16 18:45:51

by Dan Williams

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

On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski
<[email protected]> wrote:
> Hi Vinod,
>
> On Wed, 16 Oct 2013, Vinod Koul wrote:
>
>> 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
>>
>> Signed-off-by: Vinod Koul <[email protected]>
>> ---
>> drivers/dma/dmaengine.c | 2 +-
>> include/linux/dmaengine.h | 12 ++++++------
>> 2 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
>> index 9162ac8..81d8765 100644
>> --- a/drivers/dma/dmaengine.c
>> +++ b/drivers/dma/dmaengine.c
>> @@ -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)) {
>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
>> index 0bc7275..4b460a6 100644
>> --- a/include/linux/dmaengine.h
>> +++ b/include/linux/dmaengine.h
>> @@ -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,
>
> 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.

2013-10-16 20:17:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 27/28] serial: sh: use DMA_COMPLETE for dma completion status

On Wed, Oct 16, 2013 at 09:58:45PM +0530, Vinod Koul wrote:
> Signed-off-by: Vinod Koul <[email protected]>
> CC: Greg Kroah-Hartman <[email protected]>
> ---
> Greg, pls ack this as it has depedency on my tree

Acked-by: Greg Kroah-Hartman <[email protected]>

2013-10-17 00:31:58

by Joel Fernandes

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

On 10/16/2013 11:28 AM, Vinod Koul wrote:
> Signed-off-by: Vinod Koul <[email protected]>
> 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.

Tested-by: Joel Fernandes <[email protected]>

thanks,

-Joel

2013-10-17 03:00:58

by Vinod Koul

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

On Wed, Oct 16, 2013 at 11:45:48AM -0700, Dan Williams wrote:
> On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski
> >
> > 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

--

>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

Signed-off-by: Vinod Koul <[email protected]>
---
drivers/dma/dmaengine.c | 2 +-
include/linux/dmaengine.h | 13 +++++++------
2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 9162ac8..81d8765 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -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)) {
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 0bc7275..683c380 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -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)
{
--
1.7.0.4

--

2013-10-17 03:09:16

by Vinod Koul

[permalink] [raw]
Subject: [PATCH 29/29] dmaengine: remove unused DMA_SUCCESS

after all the users are converted

Signed-off-by: Vinod Koul <[email protected]>
---
include/linux/dmaengine.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 683c380..4b460a6 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -55,7 +55,6 @@ enum dma_status {
DMA_IN_PROGRESS,
DMA_PAUSED,
DMA_ERROR,
- DMA_SUCCESS,
};

/**
--
1.7.0.4

2013-10-17 04:55:32

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 28/28] net: use DMA_COMPLETE for dma completion status

From: Vinod Koul <[email protected]>
Date: Wed, 16 Oct 2013 21:58:46 +0530

> Signed-off-by: Vinod Koul <[email protected]>
> CC: "David S. Miller" <[email protected]>

Acked-by: David S. Miller <[email protected]>

2013-10-17 08:09:06

by Nicolas Ferre

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

On 16/10/2013 18:28, Vinod Koul :
> Signed-off-by: Vinod Koul <[email protected]>
> CC: Nicolas Ferre <[email protected]>

Acked-by: Nicolas Ferre <[email protected]>

> ---
> drivers/dma/at_hdmac.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index c787f38..1ef7457 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -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
>


--
Nicolas Ferre

2013-10-17 08:27:54

by Guennadi Liakhovetski

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

On Thu, 17 Oct 2013, Vinod Koul wrote:

> On Wed, Oct 16, 2013 at 11:45:48AM -0700, Dan Williams wrote:
> > On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski
> > >
> > > 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/

2013-10-17 09:00:27

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 00/28]: dmaengine: use DMA_COMPLETE for dma completion status

On Wed, Oct 16, 2013 at 6:28 PM, Vinod Koul <[email protected]> wrote:

> 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:
Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2013-10-17 10:46:20

by Vinod Koul

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

On Thu, Oct 17, 2013 at 10:27:13AM +0200, Guennadi Liakhovetski wrote:
> On Thu, 17 Oct 2013, Vinod Koul wrote:
>
> > On Wed, Oct 16, 2013 at 11:45:48AM -0700, Dan Williams wrote:
> > > On Wed, Oct 16, 2013 at 11:29 AM, Guennadi Liakhovetski
> > > >
> > > > 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.
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

> 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

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

2013-10-17 13:43:57

by Andy Shevchenko

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

On Wed, 2013-10-16 at 21:58 +0530, Vinod Koul wrote:
> Signed-off-by: Vinod Koul <[email protected]>
> CC: Andy Shevchenko <[email protected]>
> CC: Viresh Kumar <[email protected]>
> ---
> drivers/dma/dw/core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index 89eb89f..2c29331 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -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)

Acked-by: Andy Shevchenko <[email protected]>


--
Andy Shevchenko <[email protected]>
Intel Finland Oy

2013-10-17 14:18:35

by Zhangfei Gao

[permalink] [raw]
Subject: Re: [PATCH 15/28] dmaengine: k3dma: use DMA_COMPLETE for dma completion status

On Thu, Oct 17, 2013 at 12:28 AM, Vinod Koul <[email protected]> wrote:
> Signed-off-by: Vinod Koul <[email protected]>
> CC: Zhangfei Gao <[email protected]>

Thanks Vinod

Acked-by: Zhangfei Gao <[email protected]>

2013-10-17 14:19:56

by Zhangfei Gao

[permalink] [raw]
Subject: Re: [PATCH 16/28] dmaengine: mmp_tdma: use DMA_COMPLETE for dma completion status

On Thu, Oct 17, 2013 at 12:28 AM, Vinod Koul <[email protected]> wrote:
> Signed-off-by: Vinod Koul <[email protected]>
> CC: Zhangfei Gao <[email protected]>

Thanks Vinod

Acked-by: Zhangfei Gao <[email protected]>

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

On Thu, Oct 17, 2013 at 07:37:45AM +0530, Vinod Koul wrote:
> index 0bc7275..683c380 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -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,
> };

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

2013-10-17 14:40:04

by Guennadi Liakhovetski

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

Hi Sebastian

On Thu, 17 Oct 2013, Sebastian Andrzej Siewior wrote:

> On Thu, Oct 17, 2013 at 07:37:45AM +0530, Vinod Koul wrote:
> > index 0bc7275..683c380 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -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,
> > };
>
> 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?

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/

2013-10-17 14:42:04

by Vinod Koul

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

On Thu, Oct 17, 2013 at 04:27:55PM +0200, Sebastian Andrzej Siewior wrote:
> On Thu, Oct 17, 2013 at 07:37:45AM +0530, Vinod Koul wrote:
> > index 0bc7275..683c380 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -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,
> > };
>
> 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?
Yes i missed it in first place update the patch to fix that

~Vinod

2013-10-21 07:33:48

by Viresh Kumar

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

On 16 October 2013 21:58, Vinod Koul <[email protected]> wrote:
> Signed-off-by: Vinod Koul <[email protected]>
> CC: Andy Shevchenko <[email protected]>
> CC: Viresh Kumar <[email protected]>
> ---
> drivers/dma/dw/core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index 89eb89f..2c29331 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -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)

Acked-by: Viresh Kumar <[email protected]>

2013-10-24 21:29:13

by Guennadi Liakhovetski

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

Hi Vinod

On Thu, 17 Oct 2013, Vinod Koul wrote:

> On Thu, Oct 17, 2013 at 04:27:55PM +0200, Sebastian Andrzej Siewior wrote:
> > On Thu, Oct 17, 2013 at 07:37:45AM +0530, Vinod Koul wrote:
> > > index 0bc7275..683c380 100644
> > > --- a/include/linux/dmaengine.h
> > > +++ b/include/linux/dmaengine.h
> > > @@ -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,
> > > };
> >
> > 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?
> 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/

2013-10-25 05:17:08

by Vinod Koul

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

On Thu, Oct 24, 2013 at 11:28:29PM +0200, Guennadi Liakhovetski wrote:
> Hi Vinod
>
> On Thu, 17 Oct 2013, Vinod Koul wrote:
> > 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

--
~Vinod

2013-10-25 06:32:55

by Guennadi Liakhovetski

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

Hi Vinod

On Fri, 25 Oct 2013, Vinod Koul wrote:

> On Thu, Oct 24, 2013 at 11:28:29PM +0200, Guennadi Liakhovetski wrote:
> > Hi Vinod
> >
> > On Thu, 17 Oct 2013, Vinod Koul wrote:
> > > 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:

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 0bc7275..683c380 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -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.

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

2013-10-25 06:37:15

by Vinod Koul

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

On Fri, Oct 25, 2013 at 08:32:12AM +0200, Guennadi Liakhovetski wrote:
> Hi Vinod
>
> On Fri, 25 Oct 2013, Vinod Koul wrote:
>
> > On Thu, Oct 24, 2013 at 11:28:29PM +0200, Guennadi Liakhovetski wrote:
> > > Hi Vinod
> > >
> > > On Thu, 17 Oct 2013, Vinod Koul wrote:
> > > > 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:
>
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 0bc7275..683c380 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -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.
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

2013-10-25 06:43:17

by Guennadi Liakhovetski

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

On Fri, 25 Oct 2013, Vinod Koul wrote:

> On Fri, Oct 25, 2013 at 08:32:12AM +0200, Guennadi Liakhovetski wrote:
> > Hi Vinod
> >
> > On Fri, 25 Oct 2013, Vinod Koul wrote:
> >
> > > On Thu, Oct 24, 2013 at 11:28:29PM +0200, Guennadi Liakhovetski wrote:
> > > > Hi Vinod
> > > >
> > > > On Thu, 17 Oct 2013, Vinod Koul wrote:
> > > > > 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:
> >
> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> > index 0bc7275..683c380 100644
> > --- a/include/linux/dmaengine.h
> > +++ b/include/linux/dmaengine.h
> > @@ -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.
> Sure, I will fix this up now as suggested
>
> 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/

2013-10-29 16:47:57

by Olof Johansson

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

Hi,

On Thu, Oct 24, 2013 at 11:43 PM, Guennadi Liakhovetski
<[email protected]> wrote:
> On Fri, 25 Oct 2013, Vinod Koul wrote:
>
>> On Fri, Oct 25, 2013 at 08:32:12AM +0200, Guennadi Liakhovetski wrote:
>> > Hi Vinod
>> >
>> > On Fri, 25 Oct 2013, Vinod Koul wrote:
>> >
>> > > On Thu, Oct 24, 2013 at 11:28:29PM +0200, Guennadi Liakhovetski wrote:
>> > > > Hi Vinod
>> > > >
>> > > > On Thu, 17 Oct 2013, Vinod Koul wrote:
>> > > > > 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:
>> >
>> > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
>> > index 0bc7275..683c380 100644
>> > --- a/include/linux/dmaengine.h
>> > +++ b/include/linux/dmaengine.h
>> > @@ -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.
>> Sure, I will fix this up now as suggested
>>
>> 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.


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

2013-10-30 13:58:02

by Vinod Koul

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

On Tue, Oct 29, 2013 at 09:47:55AM -0700, Olof Johansson wrote:
> 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

Reported-by: Olof Johansson <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
---
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(-)

diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 8e1a024..41bca32 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -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);
}
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 29fa358..cb69f3a 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -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);
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index 179fb91..f50821c 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -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,
--
1.7.0.4

--
~Vinod