dma: various minor clean ups for slave drivers
Subsystems (5)
cover dma: various minor clean ups for slave drivers
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
Andy Shevchenko (12):
imx-sdma: remove useless variable
mxs-dma: remove useless variable
edma: no need to assign residue to 0 explicitly
ep93xx_dma: remove useless use of lock
fsldma: remove useless use of lock
mmp_pdma: remove useless use of lock
mpc512x_dma: remove useless use of lock
pch_dma: remove useless use of lock
tegra20-apb-dma: remove useless use of lock
ipu_idmac: re-use dma_cookie_status()
mmp_tdma: set cookies as well when asked for tx status
txx9dmac: return DMA_SUCCESS immediately from device_tx_status()
drivers/dma/edma.c | 2 -- drivers/dma/ep93xx_dma.c | 10 +--------- drivers/dma/fsldma.c | 10 +--------- drivers/dma/imx-sdma.c | 9 +++------ drivers/dma/ipu/ipu_idmac.c | 5 +---- drivers/dma/mmp_pdma.c | 10 +--------- drivers/dma/mmp_tdma.c | 3 ++- drivers/dma/mpc512x_dma.c | 10 +--------- drivers/dma/mxs-dma.c | 4 +--- drivers/dma/pch_dma.c | 9 +-------- drivers/dma/tegra20-apb-dma.c | 8 +++----- drivers/dma/txx9dmac.c | 13 ++++++------- 12 files changed, 21 insertions(+), 72 deletions(-)
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 1/12 imx-sdma: remove useless variable
last_used variable is applied only once, so, let's substitute it by its value.
--- drivers/dma/imx-sdma.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/dma/imx-sdma.c +3 -6
@@ -1119,15 +1119,12 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, }static enum dma_status sdma_tx_status (struct dma_chan *chan, -dma_cookie_t cookie, -struct dma_tx_state *txstate) +dma_cookie_t cookie, +struct dma_tx_state *txstate) {struct sdma_channel *sdmac =to_sdma_chan (chan); -dma_cookie_t last_used; - last_used = chan->cookie; - -dma_set_tx_state (txstate, chan->completed_cookie, last_used, +dma_set_tx_state (txstate, chan->completed_cookie, chan->cookie, sdmac->chn_count - sdmac->chn_real_count);return sdmac->status;
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 2/12 mxs-dma: remove useless variable
In reply to Andy Shevchenkolast_used variable is applied only once, so, let's substitute it by its value.
--- drivers/dma/mxs-dma.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/dma/mxs-dma.c +1 -3
@@ -622,10 +622,8 @@ static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); -dma_cookie_t last_used; - last_used = chan->cookie; -dma_set_tx_state (txstate, chan->completed_cookie, last_used,0 ); +dma_set_tx_state (txstate, chan->completed_cookie, chan->cookie,0 );return mxs_chan->status; }
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 3/12 edma: no need to assign residue to 0 explicitly
In reply to Andy ShevchenkoResidue value is assigned to 0 by dma_cookie_status().
--- drivers/dma/edma.c | 2 -- 1 file changed, 2 deletions(-)
drivers/dma/edma.c +0 -2
@@ -502,8 +502,6 @@ static enum dma_status edma_tx_status(struct dma_chan *chan, }else if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie) {struct edma_desc *edesc = echan->edesc; txstate->residue =edma_desc_size (edesc); - }else { - txstate->residue =0 ; }spin_unlock_irqrestore (&echan->vchan.lock, flags);
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 4/12 ep93xx_dma: remove useless use of lock
In reply to Andy ShevchenkoAccordingly to dma_cookie_status() description locking is not required.
--- drivers/dma/ep93xx_dma.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/dma/ep93xx_dma.c +1 -9
@@ -1313,15 +1313,7 @@ static enum dma_status ep93xx_dma_tx_status(struct dma_chan *chan,dma_cookie_t cookie, struct dma_tx_state *state) { - struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan); -enum dma_status ret; -unsigned long flags; - -spin_lock_irqsave (&edmac->lock, flags); - ret =dma_cookie_status (chan, cookie, state); -spin_unlock_irqrestore (&edmac->lock, flags); - -return ret; + return dma_cookie_status(chan, cookie, state); }/**
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 5/12 fsldma: remove useless use of lock
In reply to Andy ShevchenkoAccordingly to dma_cookie_status() description locking is not required.
--- drivers/dma/fsldma.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/dma/fsldma.c +1 -9
@@ -979,15 +979,7 @@ static enum dma_status fsl_tx_status(struct dma_chan *dchan,dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct fsldma_chan *chan = to_fsl_chan(dchan); -enum dma_status ret; -unsigned long flags; - -spin_lock_irqsave (&chan->desc_lock, flags); - ret =dma_cookie_status (dchan, cookie, txstate); -spin_unlock_irqrestore (&chan->desc_lock, flags); - -return ret; + return dma_cookie_status(dchan, cookie, txstate); }/*----------------------------------------------------------------------------*/
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 6/12 mmp_pdma: remove useless use of lock
In reply to Andy ShevchenkoAccordingly to dma_cookie_status() description locking is not required.
--- drivers/dma/mmp_pdma.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/dma/mmp_pdma.c +1 -9
@@ -632,15 +632,7 @@ static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd,static enum dma_status mmp_pdma_tx_status (struct dma_chan *dchan,dma_cookie_t cookie,struct dma_tx_state *txstate) { -struct mmp_pdma_chan *chan =to_mmp_pdma_chan (dchan); -enum dma_status ret; -unsigned long flags; - -spin_lock_irqsave (&chan->desc_lock, flags); - ret =dma_cookie_status (dchan, cookie, txstate); -spin_unlock_irqrestore (&chan->desc_lock, flags); - -return ret; +return dma_cookie_status (dchan, cookie, txstate); }/**
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 7/12 mpc512x_dma: remove useless use of lock
In reply to Andy ShevchenkoAccordingly to dma_cookie_status() description locking is not required.
--- drivers/dma/mpc512x_dma.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/dma/mpc512x_dma.c +1 -9
@@ -556,15 +556,7 @@ static enum dma_status mpc_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan); -enum dma_status ret; -unsigned long flags; - -spin_lock_irqsave (&mchan->lock, flags); - ret =dma_cookie_status (chan, cookie, txstate); -spin_unlock_irqrestore (&mchan->lock, flags); - -return ret; + return dma_cookie_status(chan, cookie, txstate); }/* Prepare descriptor for memory to memory copy */
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 8/12 pch_dma: remove useless use of lock
In reply to Andy ShevchenkoAccordingly to dma_cookie_status() description locking is not required.
--- drivers/dma/pch_dma.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/dma/pch_dma.c +1 -8
@@ -564,14 +564,7 @@ static void pd_free_chan_resources(struct dma_chan *chan)static enum dma_status pd_tx_status (struct dma_chan *chan,dma_cookie_t cookie,struct dma_tx_state *txstate) { -struct pch_dma_chan *pd_chan =to_pd_chan (chan); -enum dma_status ret; - -spin_lock_irq (&pd_chan->lock); - ret =dma_cookie_status (chan, cookie, txstate); -spin_unlock_irq (&pd_chan->lock); - -return ret; +return dma_cookie_status (chan, cookie, txstate); }static void pd_issue_pending (struct dma_chan *chan)
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 9/12 tegra20-apb-dma: remove useless use of lock
In reply to Andy ShevchenkoAccordingly to dma_cookie_status() description locking is not required.
--- drivers/dma/tegra20-apb-dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/tegra20-apb-dma.c +3 -5
@@ -767,13 +767,11 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc,unsigned long flags;unsigned int residual; -spin_lock_irqsave (&tdc->lock, flags); - ret =dma_cookie_status (dc, cookie, txstate); -if (ret ==DMA_SUCCESS ) { -spin_unlock_irqrestore (&tdc->lock, flags); +if (ret ==DMA_SUCCESS )return ret; - } + +spin_lock_irqsave (&tdc->lock, flags);/* Check on wait_ack desc status */ list_for_each_entry (dma_desc, &tdc->free_dma_desc, node) {
Signature · 1 line
1.8.2.rc0.22.gb3600c3
Laxman Dewangan
maintainerRe: [PATCH 09/12] tegra20-apb-dma: remove useless use of lock
Quoted 2 lines · Andy Shevchenko
Accordingly to
dma_cookie_status()description locking is not required.
I think we need lock here:
From isr handler, we call dma_cookie_complete() which is in spin-locked. This function updates tx->chan->completed_cookie = tx->cookie; In tegra_dma_tx_status(), we check for dma_cookie_status() which access the chan->completed_cookie; and it decides status based on this
As the access of chan->completed_cookie are from different context, we need this locking.
But did not get why it is documented as locking is not require if shared variable is getting changed/access from different context simultaneously.
Re: [PATCH 09/12] tegra20-apb-dma: remove useless use of lock
Quoted 4 lines · Laxman Dewangan
Quoted 3 lines · Andy Shevchenko
Accordingly to
dma_cookie_status()description locking is not required.
Quoted 8 lines
I think we need lock here:
From isr handler, we calldma_cookie_complete()which is in spin-locked. This function updatestx->chan->completed_cookie=tx->cookie; Integra_dma_tx_status(), we check fordma_cookie_status()which access thechan->completed_cookie; and it decides status based on thisAs the access of
chan->completed_cookieare from different context, we need this locking.
You need to have a consistent data in the cookies. This is guaranteed by memory barrier if I got it correctly.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 10/12 ipu_idmac: re-use dma_cookie_status()
In reply to Andy ShevchenkoIt's better to use generic dma_cookie_status() that allows user to get standard possible return codes independently of the DMAC driver in charge.
--- drivers/dma/ipu/ipu_idmac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dma/ipu/ipu_idmac.c +1 -4
@@ -1593,10 +1593,7 @@ static void idmac_free_chan_resources(struct dma_chan *chan)static enum dma_status idmac_tx_status (struct dma_chan *chan,dma_cookie_t cookie,struct dma_tx_state *txstate) { -dma_set_tx_state (txstate, chan->completed_cookie, chan->cookie,0 ); -if (cookie != chan->cookie) -return DMA_ERROR ; -return DMA_SUCCESS ; +return dma_cookie_status (chan, cookie, txstate); }static int __init ipu_idmac_init (struct ipu *ipu)
Signature · 1 line
1.8.2.rc0.22.gb3600c3
Re: [PATCH 10/12] ipu_idmac: re-use dma_cookie_status()
Quoted 5 lines · Andy Shevchenko
It's better to use generic
dma_cookie_status()that allows user to get standard possible return codes independently of the DMAC driver in charge.Signed-off-by Andy Shevchenko <[email protected]>Cc Shawn Guo <[email protected]>
Quoted 23 lines
--- drivers/dma/ipu/ipu_idmac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dma/ipu/ipu_idmac.c +1
-4@@ -1593,10 +1593,7 @@ static void idmac_free_chan_resources(struct dma_chan *chan)static enum dma_status idmac_tx_status (struct dma_chan *chan,dma_cookie_t cookie,struct dma_tx_state *txstate) { -dma_set_tx_state (txstate, chan->completed_cookie, chan->cookie,0 ); -if (cookie != chan->cookie) -return DMA_ERROR ; -return DMA_SUCCESS ; +return dma_cookie_status (chan, cookie, txstate); }static int __init ipu_idmac_init (struct ipu *ipu)Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 11/12 mmp_tdma: set cookies as well when asked for tx status
In reply to Andy Shevchenkodma_set_residue() sets only residue value, so user can't rely on the returned values of cookies. That patch standardize the behaviour.
--- drivers/dma/mmp_tdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/mmp_tdma.c +2 -1
@@ -456,7 +456,8 @@ static enum dma_status mmp_tdma_tx_status(struct dma_chan *chan, {struct mmp_tdma_chan *tdmac =to_mmp_tdma_chan (chan); -dma_set_residue (txstate, tdmac->buf_len - tdmac->pos); +dma_set_tx_state (txstate, chan->completed_cookie, chan->cookie, + tdmac->buf_len - tdmac->pos);return tdmac->status; }
Signature · 1 line
1.8.2.rc0.22.gb3600c3
PATCH 12/12 txx9dmac: return DMA_SUCCESS immediately from device_tx_status()
In reply to Andy ShevchenkoThere is no point to go throught the rest of the function if first call to dma_cookie_status() returned DMA_SUCCESS.
--- drivers/dma/txx9dmac.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/dma/txx9dmac.c +6 -7
@@ -962,15 +962,14 @@ 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 ) { -spin_lock_bh (&dc->lock); -txx9dmac_scan_descriptors (dc); -spin_unlock_bh (&dc->lock); +if (ret ==DMA_SUCCESS ) +return DMA_SUCCESS ; - ret =dma_cookie_status (chan, cookie, txstate); - } +spin_lock_bh (&dc->lock); +txx9dmac_scan_descriptors (dc); +spin_unlock_bh (&dc->lock); -return ret; +return dma_cookie_status (chan, cookie, txstate); } static void txx9dmac_chain_dynamic(struct txx9dmac_chan *dc,
Signature · 1 line
1.8.2.rc0.22.gb3600c3
Quoted 2 lines · Andy Shevchenko
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
The series looks fine. I am going to wait a day more and apply, pls speak up if you disagree and ack if you agree
--
~Vinod
Quoted 32 lines
Andy Shevchenko (12):
imx-sdma: remove useless variable
mxs-dma: remove useless variable
edma: no need to assign residue to 0 explicitly
ep93xx_dma: remove useless use of lock
fsldma: remove useless use of lock
mmp_pdma: remove useless use of lock
mpc512x_dma: remove useless use of lock
pch_dma: remove useless use of lock
tegra20-apb-dma: remove useless use of lock
ipu_idmac: re-usedma_cookie_status()
mmp_tdma: set cookies as well when asked for tx status
txx9dmac: returnDMA_SUCCESSimmediately fromdevice_tx_status()drivers/dma/edma.c | 2 -- drivers/dma/ep93xx_dma.c | 10 +--------- drivers/dma/fsldma.c | 10 +--------- drivers/dma/imx-sdma.c | 9 +++------ drivers/dma/ipu/ipu_idmac.c | 5 +---- drivers/dma/mmp_pdma.c | 10 +--------- drivers/dma/mmp_tdma.c | 3 ++- drivers/dma/mpc512x_dma.c | 10 +--------- drivers/dma/mxs-dma.c | 4 +--- drivers/dma/pch_dma.c | 9 +-------- drivers/dma/tegra20-apb-dma.c | 8 +++----- drivers/dma/txx9dmac.c | 13 ++++++------- 12 files changed, 21 insertions(+), 72 deletions(-)Signature · 1 line
1.8.2.rc0.22.gb3600c3
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
The series looks fine. I am going to wait a day more and apply, pls speak up if you disagree and ack if you agree
I'm not in hurry with it. Please, take your time and do whatever it requires. Thank you!
--
With Best Regards,
Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 2 lines
Quoted 2 lines
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
Applied thanks
--
~Vinod
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Quoted 2 lines
Quoted 2 lines
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
Applied thanks
Thank you. You were faster than me, I was just about to send rebased version.
Signature · 2 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy
Quoted 9 lines · Andy Shevchenko
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Quoted 2 lines
Quoted 2 lines
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
Applied thanks
Thank you. You were faster than me, I was just about to send rebased version.
:)
I suspected changes are trivial and it should apply or with slight modfications. it did apply cleanly so no reason to delay applying on shiny new -rc1
For folks in this part of world, monday morning Linus drops the rc1 usually, so get staright to it!
--
~Vinod
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
The series looks fine. I am going to wait a day more and apply, pls speak up if you disagree and ack if you agree
Looks ok to me. Reminds we can probably take this one step further and provide a generic implementation for the common case. It's just a bit inconsistent though that some engines will poll the completion handler (try to advance the state of the last completed cookie) whereas others just assume things will be completed asynchronously.
--
Dan
Quoted 4 lines · Dan Williams
Quoted 3 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
Quoted 8 lines
Quoted 2 lines
The series looks fine. I am going to wait a day more and apply, pls speak up if you disagree and ack if you agree
Looks ok to me. Reminds we can probably take this one step further and provide a generic implementation for the common case. It's just a bit inconsistent though that some engines will poll the completion handler (try to advance the state of the last completed cookie) whereas others just assume things will be completed asynchronously.
agree with that. These are the inconsistencies some of which are based on hardware and some are user iterpretations...
--
~Vinod
Quoted 5 lines · Vinod Koul
Quoted 2 lines · Andy Shevchenko
Here is a set of small independent patches that clean up or fix minor things across DMA slave drivers.
The series looks fine. I am going to wait a day more and apply, pls speak up if you disagree and ack if you agree
Kindly remind about this series.
Quoted 36 lines
--
~VinodQuoted 32 lines
Andy Shevchenko (12):
imx-sdma: remove useless variable
mxs-dma: remove useless variable
edma: no need to assign residue to 0 explicitly
ep93xx_dma: remove useless use of lock
fsldma: remove useless use of lock
mmp_pdma: remove useless use of lock
mpc512x_dma: remove useless use of lock
pch_dma: remove useless use of lock
tegra20-apb-dma: remove useless use of lock
ipu_idmac: re-usedma_cookie_status()
mmp_tdma: set cookies as well when asked for tx status
txx9dmac: returnDMA_SUCCESSimmediately fromdevice_tx_status()drivers/dma/edma.c | 2 -- drivers/dma/ep93xx_dma.c | 10 +--------- drivers/dma/fsldma.c | 10 +--------- drivers/dma/imx-sdma.c | 9 +++------ drivers/dma/ipu/ipu_idmac.c | 5 +---- drivers/dma/mmp_pdma.c | 10 +--------- drivers/dma/mmp_tdma.c | 3 ++- drivers/dma/mpc512x_dma.c | 10 +--------- drivers/dma/mxs-dma.c | 4 +--- drivers/dma/pch_dma.c | 9 +-------- drivers/dma/tegra20-apb-dma.c | 8 +++----- drivers/dma/txx9dmac.c | 13 ++++++------- 12 files changed, 21 insertions(+), 72 deletions(-)Signature · 1 line
1.8.2.rc0.22.gb3600c3
Signature · 2 lines
Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]> Intel Finland Oy