Commit f641dddd authored by Martin Hicks's avatar Martin Hicks Committed by Herbert Xu

crypto: talitos - Simplify per-channel initialization

There were multiple loops in a row, for each separate step of the
initialization of the channels.  Simplify to a single loop.
Signed-off-by: default avatarMartin Hicks <mort@bork.org>
Acked-by: default avatarKim Phillips <kim.phillips@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 37821da0
...@@ -2706,20 +2706,16 @@ static int talitos_probe(struct platform_device *ofdev) ...@@ -2706,20 +2706,16 @@ static int talitos_probe(struct platform_device *ofdev)
goto err_out; goto err_out;
} }
priv->fifo_len = roundup_pow_of_two(priv->chfifo_len);
for (i = 0; i < priv->num_channels; i++) { for (i = 0; i < priv->num_channels; i++) {
priv->chan[i].reg = priv->reg + TALITOS_CH_STRIDE * (i + 1); priv->chan[i].reg = priv->reg + TALITOS_CH_STRIDE * (i + 1);
if (!priv->irq[1] || !(i & 1)) if (!priv->irq[1] || !(i & 1))
priv->chan[i].reg += TALITOS_CH_BASE_OFFSET; priv->chan[i].reg += TALITOS_CH_BASE_OFFSET;
}
for (i = 0; i < priv->num_channels; i++) {
spin_lock_init(&priv->chan[i].head_lock); spin_lock_init(&priv->chan[i].head_lock);
spin_lock_init(&priv->chan[i].tail_lock); spin_lock_init(&priv->chan[i].tail_lock);
}
priv->fifo_len = roundup_pow_of_two(priv->chfifo_len);
for (i = 0; i < priv->num_channels; i++) {
priv->chan[i].fifo = kzalloc(sizeof(struct talitos_request) * priv->chan[i].fifo = kzalloc(sizeof(struct talitos_request) *
priv->fifo_len, GFP_KERNEL); priv->fifo_len, GFP_KERNEL);
if (!priv->chan[i].fifo) { if (!priv->chan[i].fifo) {
...@@ -2727,11 +2723,10 @@ static int talitos_probe(struct platform_device *ofdev) ...@@ -2727,11 +2723,10 @@ static int talitos_probe(struct platform_device *ofdev)
err = -ENOMEM; err = -ENOMEM;
goto err_out; goto err_out;
} }
}
for (i = 0; i < priv->num_channels; i++)
atomic_set(&priv->chan[i].submit_count, atomic_set(&priv->chan[i].submit_count,
-(priv->chfifo_len - 1)); -(priv->chfifo_len - 1));
}
dma_set_mask(dev, DMA_BIT_MASK(36)); dma_set_mask(dev, DMA_BIT_MASK(36));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment