]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: sun8i-ce - fold sun8i_ce_cipher_run() into sun8i_ce_cipher_do_one()
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>
Tue, 2 Sep 2025 13:21:31 +0000 (16:21 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 13 Sep 2025 04:11:05 +0000 (12:11 +0800)
Fold sun8i_ce_cipher_run() into it's only caller, sun8i_ce_cipher_do_one(),
to eliminate a bit of boilerplate.

Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c

index 69ba8236cf2de5f4da49289be4be661a7a4f3c4e..f63d21cd1e52e75c3bf68aeab8ce47bf764db9ce 100644 (file)
@@ -360,31 +360,28 @@ static void sun8i_ce_cipher_unprepare(struct crypto_engine *engine,
        dma_unmap_single(ce->dev, rctx->addr_key, op->keylen, DMA_TO_DEVICE);
 }
 
-static void sun8i_ce_cipher_run(struct crypto_engine *engine, void *areq)
-{
-       struct skcipher_request *breq = container_of(areq, struct skcipher_request, base);
-       struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(breq);
-       struct sun8i_cipher_tfm_ctx *op = crypto_skcipher_ctx(tfm);
-       struct sun8i_ce_dev *ce = op->ce;
-       struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(breq);
-       int flow, err;
-
-       flow = rctx->flow;
-       err = sun8i_ce_run_task(ce, flow, crypto_tfm_alg_name(breq->base.tfm));
-       sun8i_ce_cipher_unprepare(engine, areq);
-       local_bh_disable();
-       crypto_finalize_skcipher_request(engine, breq, err);
-       local_bh_enable();
-}
-
 int sun8i_ce_cipher_do_one(struct crypto_engine *engine, void *areq)
 {
-       int err = sun8i_ce_cipher_prepare(engine, areq);
+       struct skcipher_request *req = skcipher_request_cast(areq);
+       struct sun8i_cipher_req_ctx *rctx = skcipher_request_ctx(req);
+       struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
+       struct sun8i_cipher_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
+       struct sun8i_ce_dev *ce = ctx->ce;
+       int err;
 
+       err = sun8i_ce_cipher_prepare(engine, areq);
        if (err)
                return err;
 
-       sun8i_ce_cipher_run(engine, areq);
+       err = sun8i_ce_run_task(ce, rctx->flow,
+                               crypto_tfm_alg_name(req->base.tfm));
+
+       sun8i_ce_cipher_unprepare(engine, areq);
+
+       local_bh_disable();
+       crypto_finalize_skcipher_request(engine, req, err);
+       local_bh_enable();
+
        return 0;
 }