dma: various fixes in different DMAC drivers
Subsystems (3)
v2 cover dma: various fixes in different DMAC drivers
This is a patcset of independent fixes of the DMAC drivers. They are simple and being understandable in their context.
Since v1:
- address all comments
- add ACKs
- rebase on top of recent Vinod's next branch
Andy Shevchenko (6):
dma: of-dma: protect list write operation by spin_lock dmaengine.h: remove redundant else keyword
dma: coh901318: avoid unbalanced locking
dma: coh901318: set residue only if dma is in progress
edma: do not waste memory for dma_mask
dma: tegra20-apb-dma: remove unnecessary assignment
drivers/dma/coh901318.c | 4 +++- drivers/dma/coh901318_lli.c | 2 +- drivers/dma/edma.c | 6 ++++-- drivers/dma/of-dma.c | 2 ++ drivers/dma/tegra20-apb-dma.c | 1 - include/linux/dmaengine.h | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.10.4
PATCH v2 1/6 dma: of-dma: protect list write operation by spin_lock
It's possible to have an inconsistency in the list due to unprotected operation on it. The patch adds a proper locking on the list operation.
--- drivers/dma/of-dma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/dma/of-dma.c +2 -0
@@ -117,7 +117,9 @@ int of_dma_controller_register(struct device_node *np, ofdma->use_count =0 ;/* Now queue of_dma controller structure in list */ +spin_lock (&of_dma_lock);list_add_tail (&ofdma->of_dma_controllers, &of_dma_list); +spin_unlock (&of_dma_lock);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v2 2/6 dmaengine.h: remove redundant else keyword
In reply to Andy Shevchenkodmaengine_device_control returns -ENOSYS in case the dma driver doesn't have such functionality.
--- include/linux/dmaengine.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/dmaengine.h +2 -2
@@ -610,8 +610,8 @@ static inline int dmaengine_device_control(struct dma_chan *chan, {if (chan->device->device_control)return chan->device->device_control (chan, cmd, arg); -else -return -ENOSYS ; + +return -ENOSYS ; } static inline int dmaengine_slave_config(struct dma_chan *chan,
Signature · 1 line
1.7.10.4
PATCH v2 3/6 dma: coh901318: avoid unbalanced locking
In reply to Andy ShevchenkoIn case the len is 0 we must return without trying to unlock the lock that was not locked.
--- drivers/dma/coh901318_lli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/coh901318_lli.c +1 -1
@@ -61,7 +61,7 @@ coh901318_lli_alloc(struct coh901318_pool *pool, unsigned int len)dma_addr_t phy;if (len ==0 ) - goto err; +return NULL ;spin_lock (&pool->lock);
Signature · 1 line
1.7.10.4
PATCH v2 4/6 dma: coh901318: set residue only if dma is in progress
In reply to Andy ShevchenkoWhen status is DMA_SUCCESS the residue should be zero. Otherwise it's a bug.
--- drivers/dma/coh901318.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/coh901318.c +3 -1
@@ -1147,7 +1147,9 @@ coh901318_tx_status(struct dma_chan *chan, dma_cookie_t cookie,enum dma_status ret; ret =dma_cookie_status (chan, cookie, txstate); -/* FIXME: should be conditional on ret != DMA_SUCCESS? */ +if (ret ==DMA_SUCCESS ) +return ret; +dma_set_residue (txstate,coh901318_get_bytes_left (chan));if (ret ==DMA_IN_PROGRESS && cohc->stopped)
Signature · 1 line
1.7.10.4
PATCH v2 5/6 edma: do not waste memory for dma_mask
In reply to Andy ShevchenkoAccordingly to commentary in the platform_device_register_full the memory allocated for dma_mask will not going to be freed. That's why is better to assign dma_mask afterwards.
--- drivers/dma/edma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/edma.c +4 -2
@@ -620,13 +620,11 @@ static struct platform_device *pdev0, *pdev1;static const struct platform_device_info edma_dev_info0 = { .name ="edma-dma-engine" , .id =0 , - .dma_mask =DMA_BIT_MASK (32 ), };static const struct platform_device_info edma_dev_info1 = { .name ="edma-dma-engine" , .id =1 , - .dma_mask =DMA_BIT_MASK (32 ), };static int edma_init (void )
@@ -640,6 +638,8 @@ static int edma_init(void) ret =PTR_ERR (pdev0); goto out; } + pdev0->dev.dma_mask = &pdev0->dev.coherent_dma_mask; + pdev0->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); }if (EDMA_CTLRS ==2 ) {
@@ -649,6 +649,8 @@ static int edma_init(void)platform_device_unregister (pdev0); ret =PTR_ERR (pdev1); } + pdev1->dev.dma_mask = &pdev1->dev.coherent_dma_mask; + pdev1->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); } out:
Signature · 1 line
1.7.10.4
PATCH v2 6/6 dma: tegra20-apb-dma: remove unnecessary assignment
In reply to Andy ShevchenkoThere is no need to assign 0 to residue, because dma_cookie_status() does this for us.
--- drivers/dma/tegra20-apb-dma.c | 1 - 1 file changed, 1 deletion(-)
drivers/dma/tegra20-apb-dma.c +0 -1
@@ -767,7 +767,6 @@ static enum dma_status tegra_dma_tx_status(struct dma_chan *dc, ret =dma_cookie_status (dc, cookie, txstate);if (ret ==DMA_SUCCESS ) { -dma_set_residue (txstate,0 );spin_unlock_irqrestore (&tdc->lock, flags);return ret; }
Signature · 1 line
1.7.10.4
Quoted 2 lines · Andy Shevchenko
This is a patcset of independent fixes of the DMAC drivers. They are simple and being understandable in their context.
all applied, thanks
--
~Vinod
Quoted 25 lines
Since v1:
- address all comments
- add ACKs
- rebase on top of recent Vinod's next branchAndy Shevchenko (6):
dma: of-dma: protect list write operation byspin_lockdmaengine.h: remove redundant else keyword
dma: coh901318: avoid unbalanced locking
dma: coh901318: set residue only if dma is in progress
edma: do not waste memory fordma_mask
dma: tegra20-apb-dma: remove unnecessary assignmentdrivers/dma/coh901318.c | 4 +++- drivers/dma/coh901318_lli.c | 2 +- drivers/dma/edma.c | 6 ++++-- drivers/dma/of-dma.c | 2 ++ drivers/dma/tegra20-apb-dma.c | 1 - include/linux/dmaengine.h | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-)Signature · 1 line
1.7.10.4