diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2010-06-20 17:25:39 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-06-22 21:01:54 -0400 |
commit | 2292b880e411276d127a020a1c35ca149fcca992 (patch) | |
tree | 2f11c87c46cfbc6140649687854b0127dba1fcaa /drivers/dma/ste_dma40.c | |
parent | 0d0f6b8bbb13e1287f4f2a271e4f4306789511a2 (diff) |
DMAENGINE: ste_dma40: lock fix
Fix up some locking issues found by enabling lock debugging.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r-- | drivers/dma/ste_dma40.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 4d56d214fa05..ebffb53c036c 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -441,6 +441,7 @@ static int d40_lcla_id_get(struct d40_chan *d40c, | |||
441 | pool->base + d40c->phy_chan->num * 1024; | 441 | pool->base + d40c->phy_chan->num * 1024; |
442 | int i; | 442 | int i; |
443 | int lli_per_log = d40c->base->plat_data->llis_per_log; | 443 | int lli_per_log = d40c->base->plat_data->llis_per_log; |
444 | unsigned long flags; | ||
444 | 445 | ||
445 | if (d40c->lcla.src_id >= 0 && d40c->lcla.dst_id >= 0) | 446 | if (d40c->lcla.src_id >= 0 && d40c->lcla.dst_id >= 0) |
446 | return 0; | 447 | return 0; |
@@ -448,7 +449,7 @@ static int d40_lcla_id_get(struct d40_chan *d40c, | |||
448 | if (pool->num_blocks > 32) | 449 | if (pool->num_blocks > 32) |
449 | return -EINVAL; | 450 | return -EINVAL; |
450 | 451 | ||
451 | spin_lock(&pool->lock); | 452 | spin_lock_irqsave(&pool->lock, flags); |
452 | 453 | ||
453 | for (i = 0; i < pool->num_blocks; i++) { | 454 | for (i = 0; i < pool->num_blocks; i++) { |
454 | if (!(pool->alloc_map[d40c->phy_chan->num] & (0x1 << i))) { | 455 | if (!(pool->alloc_map[d40c->phy_chan->num] & (0x1 << i))) { |
@@ -477,10 +478,10 @@ static int d40_lcla_id_get(struct d40_chan *d40c, | |||
477 | d40c->lcla.src = lcla_lidx_base + src_id * lli_per_log + 1; | 478 | d40c->lcla.src = lcla_lidx_base + src_id * lli_per_log + 1; |
478 | 479 | ||
479 | 480 | ||
480 | spin_unlock(&pool->lock); | 481 | spin_unlock_irqrestore(&pool->lock, flags); |
481 | return 0; | 482 | return 0; |
482 | err: | 483 | err: |
483 | spin_unlock(&pool->lock); | 484 | spin_unlock_irqrestore(&pool->lock, flags); |
484 | return -EINVAL; | 485 | return -EINVAL; |
485 | } | 486 | } |
486 | 487 | ||
@@ -488,15 +489,16 @@ static void d40_lcla_id_put(struct d40_chan *d40c, | |||
488 | struct d40_lcla_pool *pool, | 489 | struct d40_lcla_pool *pool, |
489 | int id) | 490 | int id) |
490 | { | 491 | { |
492 | unsigned long flags; | ||
491 | if (id < 0) | 493 | if (id < 0) |
492 | return; | 494 | return; |
493 | 495 | ||
494 | d40c->lcla.src_id = -1; | 496 | d40c->lcla.src_id = -1; |
495 | d40c->lcla.dst_id = -1; | 497 | d40c->lcla.dst_id = -1; |
496 | 498 | ||
497 | spin_lock(&pool->lock); | 499 | spin_lock_irqsave(&pool->lock, flags); |
498 | pool->alloc_map[d40c->phy_chan->num] &= (~(0x1 << id)); | 500 | pool->alloc_map[d40c->phy_chan->num] &= (~(0x1 << id)); |
499 | spin_unlock(&pool->lock); | 501 | spin_unlock_irqrestore(&pool->lock, flags); |
500 | } | 502 | } |
501 | 503 | ||
502 | static int d40_channel_execute_command(struct d40_chan *d40c, | 504 | static int d40_channel_execute_command(struct d40_chan *d40c, |
@@ -1984,8 +1986,6 @@ static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan, | |||
1984 | if (d40d == NULL) | 1986 | if (d40d == NULL) |
1985 | return NULL; | 1987 | return NULL; |
1986 | 1988 | ||
1987 | memset(d40d, 0, sizeof(struct d40_desc)); | ||
1988 | |||
1989 | if (d40c->log_num != D40_PHY_CHAN) | 1989 | if (d40c->log_num != D40_PHY_CHAN) |
1990 | err = d40_prep_slave_sg_log(d40d, d40c, sgl, sg_len, | 1990 | err = d40_prep_slave_sg_log(d40d, d40c, sgl, sg_len, |
1991 | direction, dma_flags); | 1991 | direction, dma_flags); |