Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbeACUZG (ORCPT + 1 other); Wed, 3 Jan 2018 15:25:06 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42454 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752200AbeACUN2 (ORCPT ); Wed, 3 Jan 2018 15:13:28 -0500 X-Google-Smtp-Source: ACJfBovxwLjYqkDBN2Y3s9kSTwd4SyXaQkZ4Sy7wEeet+8oz3w1ws7FYNXdaOxCJ9Df9RjGrnPrn+Q== From: Corentin Labbe To: alexandre.torgue@st.com, arei.gonglei@huawei.com, corbet@lwn.net, davem@davemloft.net, herbert@gondor.apana.org.au, jasowang@redhat.com, mcoquelin.stm32@gmail.com, mst@redhat.com Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, fabien.dessenne@st.com, Corentin Labbe Subject: [PATCH 5/6] crypto: stm32-hash: convert to the new crypto engine API Date: Wed, 3 Jan 2018 21:11:08 +0100 Message-Id: <20180103201109.16077-6-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180103201109.16077-1-clabbe.montjoie@gmail.com> References: <20180103201109.16077-1-clabbe.montjoie@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This patch convert the stm32-hash driver to the new crypto engine API. Signed-off-by: Corentin Labbe --- drivers/crypto/stm32/stm32-hash.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index 4ca4a264a833..9790c2c936c7 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -122,6 +122,7 @@ enum stm32_hash_data_format { #define HASH_DMA_THRESHOLD 50 struct stm32_hash_ctx { + struct crypto_engine_reqctx enginectx; struct stm32_hash_dev *hdev; unsigned long flags; @@ -828,6 +829,11 @@ static int stm32_hash_hw_init(struct stm32_hash_dev *hdev, return 0; } +static int stm32_hash_one_request(struct crypto_engine *engine, + void *areq); +static int stm32_hash_prepare_req(struct crypto_engine *engine, + void *areq); + static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev, struct ahash_request *req) { @@ -835,8 +841,9 @@ static int stm32_hash_handle_queue(struct stm32_hash_dev *hdev, } static int stm32_hash_prepare_req(struct crypto_engine *engine, - struct ahash_request *req) + void *areq) { + struct ahash_request *req = container_of(areq, struct ahash_request, base); struct stm32_hash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req)); struct stm32_hash_dev *hdev = stm32_hash_find_dev(ctx); struct stm32_hash_request_ctx *rctx; @@ -855,8 +862,9 @@ static int stm32_hash_prepare_req(struct crypto_engine *engine, } static int stm32_hash_one_request(struct crypto_engine *engine, - struct ahash_request *req) + void *areq) { + struct ahash_request *req = container_of(areq, struct ahash_request, base); struct stm32_hash_ctx *ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req)); struct stm32_hash_dev *hdev = stm32_hash_find_dev(ctx); struct stm32_hash_request_ctx *rctx; @@ -1033,6 +1041,9 @@ static int stm32_hash_cra_init_algs(struct crypto_tfm *tfm, if (algs_hmac_name) ctx->flags |= HASH_FLAGS_HMAC; + ctx->enginectx.op.do_one_request = stm32_hash_one_request; + ctx->enginectx.op.prepare_request = stm32_hash_prepare_req; + ctx->enginectx.op.unprepare_request = NULL; return 0; } @@ -1493,9 +1504,6 @@ static int stm32_hash_probe(struct platform_device *pdev) goto err_engine; } - hdev->engine->prepare_hash_request = stm32_hash_prepare_req; - hdev->engine->hash_one_request = stm32_hash_one_request; - ret = crypto_engine_start(hdev->engine); if (ret) goto err_engine_start; -- 2.13.6