crypto: rk3288 - Remove prepare/unprepare request
The callbacks for prepare and unprepare request in crypto_engine is superfluous. They can be done directly from do_one_request. Move the code into do_one_request and remove the unused callbacks. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@ -240,14 +240,13 @@ static int rk_hash_prepare(struct crypto_engine *engine, void *breq)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rk_hash_unprepare(struct crypto_engine *engine, void *breq)
|
static void rk_hash_unprepare(struct crypto_engine *engine, void *breq)
|
||||||
{
|
{
|
||||||
struct ahash_request *areq = container_of(breq, struct ahash_request, base);
|
struct ahash_request *areq = container_of(breq, struct ahash_request, base);
|
||||||
struct rk_ahash_rctx *rctx = ahash_request_ctx(areq);
|
struct rk_ahash_rctx *rctx = ahash_request_ctx(areq);
|
||||||
struct rk_crypto_info *rkc = rctx->dev;
|
struct rk_crypto_info *rkc = rctx->dev;
|
||||||
|
|
||||||
dma_unmap_sg(rkc->dev, areq->src, rctx->nrsg, DMA_TO_DEVICE);
|
dma_unmap_sg(rkc->dev, areq->src, rctx->nrsg, DMA_TO_DEVICE);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rk_hash_run(struct crypto_engine *engine, void *breq)
|
static int rk_hash_run(struct crypto_engine *engine, void *breq)
|
||||||
@ -259,7 +258,7 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)
|
|||||||
struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.hash);
|
struct rk_crypto_tmp *algt = container_of(alg, struct rk_crypto_tmp, alg.hash);
|
||||||
struct scatterlist *sg = areq->src;
|
struct scatterlist *sg = areq->src;
|
||||||
struct rk_crypto_info *rkc = rctx->dev;
|
struct rk_crypto_info *rkc = rctx->dev;
|
||||||
int err = 0;
|
int err;
|
||||||
int i;
|
int i;
|
||||||
u32 v;
|
u32 v;
|
||||||
|
|
||||||
@ -267,6 +266,10 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
err = rk_hash_prepare(engine, breq);
|
||||||
|
if (err)
|
||||||
|
goto theend;
|
||||||
|
|
||||||
rctx->mode = 0;
|
rctx->mode = 0;
|
||||||
|
|
||||||
algt->stat_req++;
|
algt->stat_req++;
|
||||||
@ -327,6 +330,8 @@ theend:
|
|||||||
crypto_finalize_hash_request(engine, breq, err);
|
crypto_finalize_hash_request(engine, breq, err);
|
||||||
local_bh_enable();
|
local_bh_enable();
|
||||||
|
|
||||||
|
rk_hash_unprepare(engine, breq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,8 +355,6 @@ static int rk_cra_hash_init(struct crypto_tfm *tfm)
|
|||||||
crypto_ahash_reqsize(tctx->fallback_tfm));
|
crypto_ahash_reqsize(tctx->fallback_tfm));
|
||||||
|
|
||||||
tctx->enginectx.op.do_one_request = rk_hash_run;
|
tctx->enginectx.op.do_one_request = rk_hash_run;
|
||||||
tctx->enginectx.op.prepare_request = rk_hash_prepare;
|
|
||||||
tctx->enginectx.op.unprepare_request = rk_hash_unprepare;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user