dmaengine: ste_dma40: minor code readability fixes

Use internal variables to the cycles to improve code readability, no
functional changes.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
This commit is contained in:
Fabio Baltieri 2012-12-18 16:59:09 +01:00
Родитель f26e03ad2b
Коммит 7ce529efbc
1 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -639,19 +639,18 @@ static int d40_lcla_alloc_one(struct d40_chan *d40c,
unsigned long flags; unsigned long flags;
int i; int i;
int ret = -EINVAL; int ret = -EINVAL;
int p;
spin_lock_irqsave(&d40c->base->lcla_pool.lock, flags); spin_lock_irqsave(&d40c->base->lcla_pool.lock, flags);
p = d40c->phy_chan->num * D40_LCLA_LINK_PER_EVENT_GRP;
/* /*
* Allocate both src and dst at the same time, therefore the half * Allocate both src and dst at the same time, therefore the half
* start on 1 since 0 can't be used since zero is used as end marker. * start on 1 since 0 can't be used since zero is used as end marker.
*/ */
for (i = 1 ; i < D40_LCLA_LINK_PER_EVENT_GRP / 2; i++) { for (i = 1 ; i < D40_LCLA_LINK_PER_EVENT_GRP / 2; i++) {
if (!d40c->base->lcla_pool.alloc_map[p + i]) { int idx = d40c->phy_chan->num * D40_LCLA_LINK_PER_EVENT_GRP + i;
d40c->base->lcla_pool.alloc_map[p + i] = d40d;
if (!d40c->base->lcla_pool.alloc_map[idx]) {
d40c->base->lcla_pool.alloc_map[idx] = d40d;
d40d->lcla_alloc++; d40d->lcla_alloc++;
ret = i; ret = i;
break; break;
@ -676,10 +675,10 @@ static int d40_lcla_free_all(struct d40_chan *d40c,
spin_lock_irqsave(&d40c->base->lcla_pool.lock, flags); spin_lock_irqsave(&d40c->base->lcla_pool.lock, flags);
for (i = 1 ; i < D40_LCLA_LINK_PER_EVENT_GRP / 2; i++) { for (i = 1 ; i < D40_LCLA_LINK_PER_EVENT_GRP / 2; i++) {
if (d40c->base->lcla_pool.alloc_map[d40c->phy_chan->num * int idx = d40c->phy_chan->num * D40_LCLA_LINK_PER_EVENT_GRP + i;
D40_LCLA_LINK_PER_EVENT_GRP + i] == d40d) {
d40c->base->lcla_pool.alloc_map[d40c->phy_chan->num * if (d40c->base->lcla_pool.alloc_map[idx] == d40d) {
D40_LCLA_LINK_PER_EVENT_GRP + i] = NULL; d40c->base->lcla_pool.alloc_map[idx] = NULL;
d40d->lcla_alloc--; d40d->lcla_alloc--;
if (d40d->lcla_alloc == 0) { if (d40d->lcla_alloc == 0) {
ret = 0; ret = 0;