[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200122104528.30084-4-clabbe.montjoie@gmail.com>
Date: Wed, 22 Jan 2020 11:45:22 +0100
From: Corentin Labbe <clabbe.montjoie@...il.com>
To: davem@...emloft.net, herbert@...dor.apana.org.au,
mripard@...nel.org, wens@...e.org, iuliana.prodan@....com
Cc: linux-arm-kernel@...ts.infradead.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sunxi@...glegroups.com,
Corentin Labbe <clabbe.montjoie@...il.com>
Subject: [PATCH 3/9] crypto: engine: get rid of cur_req
cur_req was used as a sign of usage of the crypto_engine, now this
behaviour has gone, its usage remains for detecting if we finalize the
cur_req.
But testing if we finalize the cur_req prevent to do more request at a
time and is unnecessary.
It is unnecessary since crypto_finalize_request() is only used for
cryptoengine and so the request finalized will be always the current
request.
Signed-off-by: Corentin Labbe <clabbe.montjoie@...il.com>
---
crypto/crypto_engine.c | 25 ++++++-------------------
include/crypto/engine.h | 2 --
2 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c
index dfcb00e92e09..c21867106aa4 100644
--- a/crypto/crypto_engine.c
+++ b/crypto/crypto_engine.c
@@ -24,27 +24,15 @@
static void crypto_finalize_request(struct crypto_engine *engine,
struct crypto_async_request *req, int err)
{
- unsigned long flags;
- bool finalize_cur_req = false;
int ret;
struct crypto_engine_ctx *enginectx;
- spin_lock_irqsave(&engine->queue_lock, flags);
- if (engine->cur_req == req)
- finalize_cur_req = true;
- spin_unlock_irqrestore(&engine->queue_lock, flags);
-
- if (finalize_cur_req) {
- enginectx = crypto_tfm_ctx(req->tfm);
- if (enginectx->op.prepare_request &&
- enginectx->op.unprepare_request) {
- ret = enginectx->op.unprepare_request(engine, req);
- if (ret)
- dev_err(engine->dev, "failed to unprepare request\n");
- }
- spin_lock_irqsave(&engine->queue_lock, flags);
- engine->cur_req = NULL;
- spin_unlock_irqrestore(&engine->queue_lock, flags);
+ enginectx = crypto_tfm_ctx(req->tfm);
+ if (enginectx->op.prepare_request &&
+ enginectx->op.unprepare_request) {
+ ret = enginectx->op.unprepare_request(engine, req);
+ if (ret)
+ dev_err(engine->dev, "failed to unprepare request\n");
}
req->complete(req, err);
@@ -101,7 +89,6 @@ static void crypto_pump_requests(struct crypto_engine *engine,
if (!async_req)
goto out;
- engine->cur_req = async_req;
if (backlog)
backlog->complete(backlog, -EINPROGRESS);
diff --git a/include/crypto/engine.h b/include/crypto/engine.h
index 4d8a2602c9ed..d77080227beb 100644
--- a/include/crypto/engine.h
+++ b/include/crypto/engine.h
@@ -36,7 +36,6 @@
* @kworker: kthread worker struct for request pump
* @pump_requests: work struct for scheduling work to the request pump
* @priv_data: the engine private data
- * @cur_req: the current request which is on processing
*/
struct crypto_engine {
char name[ENGINE_NAME_LEN];
@@ -57,7 +56,6 @@ struct crypto_engine {
struct kthread_work pump_requests;
void *priv_data;
- struct crypto_async_request *cur_req;
};
/*
--
2.24.1
Powered by blists - more mailing lists