[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241001232547.355947-5-rosenp@gmail.com>
Date: Tue, 1 Oct 2024 16:25:46 -0700
From: Rosen Penev <rosenp@...il.com>
To: linux-crypto@...r.kernel.org
Cc: Boris Brezillon <bbrezillon@...nel.org>,
Arnaud Ebalard <arno@...isbad.org>,
Srujana Challa <schalla@...vell.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Rosen Penev <rosenp@...il.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 4/5] crypto: cesa: move loop to mv_cesa_put_sram
Simpler to move it there. More readable remove.
Signed-off-by: Rosen Penev <rosenp@...il.com>
---
drivers/crypto/marvell/cesa/cesa.c | 31 +++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/crypto/marvell/cesa/cesa.c b/drivers/crypto/marvell/cesa/cesa.c
index 6098518e136e..3dc74d1a8514 100644
--- a/drivers/crypto/marvell/cesa/cesa.c
+++ b/drivers/crypto/marvell/cesa/cesa.c
@@ -416,17 +416,23 @@ static int mv_cesa_get_sram(struct platform_device *pdev, int idx)
return 0;
}
-static void mv_cesa_put_sram(struct platform_device *pdev, int idx)
+static void mv_cesa_put_sram(struct platform_device *pdev)
{
struct mv_cesa_dev *cesa = platform_get_drvdata(pdev);
- struct mv_cesa_engine *engine = &cesa->engines[idx];
+ const struct mv_cesa_caps *caps = &orion_caps;
+ int i;
- if (engine->pool)
- gen_pool_free(engine->pool, (unsigned long)engine->sram_pool,
- cesa->sram_size);
- else
- dma_unmap_resource(cesa->dev, engine->sram_dma,
- cesa->sram_size, DMA_BIDIRECTIONAL, 0);
+ for (i = 0; i < caps->nengines; i++) {
+ struct mv_cesa_engine *engine = &cesa->engines[i];
+ if (engine->pool)
+ gen_pool_free(engine->pool,
+ (unsigned long)engine->sram_pool,
+ cesa->sram_size);
+ else
+ dma_unmap_resource(cesa->dev, engine->sram_dma,
+ cesa->sram_size, DMA_BIDIRECTIONAL,
+ 0);
+ }
}
static int mv_cesa_probe(struct platform_device *pdev)
@@ -562,21 +568,16 @@ static int mv_cesa_probe(struct platform_device *pdev)
return 0;
err_cleanup:
- for (i = 0; i < caps->nengines; i++)
- mv_cesa_put_sram(pdev, i);
-
+ mv_cesa_put_sram(pdev);
return ret;
}
static void mv_cesa_remove(struct platform_device *pdev)
{
struct mv_cesa_dev *cesa = platform_get_drvdata(pdev);
- int i;
mv_cesa_remove_algs(cesa);
-
- for (i = 0; i < cesa->caps->nengines; i++)
- mv_cesa_put_sram(pdev, i);
+ mv_cesa_put_sram(pdev);
}
static const struct platform_device_id mv_cesa_plat_id_table[] = {
--
2.46.2
Powered by blists - more mailing lists