From patchwork Wed Jan 3 20:11:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 10143299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 59C6660594 for ; Wed, 3 Jan 2018 20:31:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F27C2930B for ; Wed, 3 Jan 2018 20:31:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43FFD2930D; Wed, 3 Jan 2018 20:31:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD42E2930E for ; Wed, 3 Jan 2018 20:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=8rZJ8WHJ5RV6CF/LyjMi7fU/PCnBj6Ucr00dYlu/Qmw=; b=EgKUcjnn2NdxbHy0eht0Poa3dJ cQIof0V+CX7FUJb0mq1N8wkSR2+OMaQvB0+ApjHx6C8D6c4eTtQ7CPXiZfx6G0w6UqtJ21lZ7cCcP AeJGDUklYVcr7njZrjuDzpwuw12JkYvRHsuh8pS2lIzAY3e9xRJsi2z1BizuAX9yQKJ/FA1sceR4Q jwsXedCLrJxelgZc+003Qqjaqku5bzN4Bplweu5SuiJoORlctLhG4CDdiNe+tKy1zUPBDiAzQNpwy s9ZiZ4Xnov3KQ9VE7Gm36D1EvV7IdWj0PRGxzXV13SlS8FmVGmog25t7sO2T1sSTs9dEuqhYeCAt+ WOrqdYTw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eWphR-0003qe-6t; Wed, 03 Jan 2018 20:31:45 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWphP-0002t4-Hd for linux-arm-kernel@bombadil.infradead.org; Wed, 03 Jan 2018 20:31:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+lyLVjEDcCmHazDWRuGxSuP3x/WTn0GZt6pNizNjjRc=; b=KMcQKS3jUx587QHQ2HlBL8eFv 6udmYKXNHufahq207YToFYjrRWT56XWSUphyHGQvk+Bp4l+mBqBIkiD8lF92lhHuvjHCk6kXtDzxR QfNxP5dFfJjRg7EHswQz3jdplPAlYNvMvTeA3mmtLJezE+MzKhOldOPTop1sYr1P+QU0byRPNFQCT CE+13gDa/4yoWHO7n3+3RT1mbvIbOSo7pIfvLq45533i29jJRmkyBY4gmT+2t4zirh6/BFnM+AGxE PUIFM5Fqxo2BV+WMJOT0S57uxjSuvECL1jnJDtxOCTwJFS+qgIRX148QBqSy16YYnhlbPk7hbi6ia 2joMZXu7A==; Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWpPt-0004ZV-VI for linux-arm-kernel@lists.infradead.org; Wed, 03 Jan 2018 20:13:41 +0000 Received: by mail-wr0-x242.google.com with SMTP id y9so2847210wrb.5 for ; Wed, 03 Jan 2018 12:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+lyLVjEDcCmHazDWRuGxSuP3x/WTn0GZt6pNizNjjRc=; b=XNUkhoWPZi6vVgZycj4mqzsr0jxf5rA9Tse1R1qzg6ngpJVmcmyklRBBp0gkmhOHDr x0a627QWehs8QcbjtvFmTg3OMW23C+i6dzItzSavd1FbLMt8PwlwSS5u5KlLycXI3tkG sG0NYAV8Em6U63LvBkp0XJV0wCfOIxNVH8S31YNgvlFO0/P4HuMhXyfr6aCy/MulXfhX n3y3aFJAKLFtn+5WiCYn30wXtiK8MAZTw21jl7buCtCZApQT7jZnNc8DrfL83TI6MOWG PZYdXM0zzeekV//lDrdFxck0R0m6qwFd6e/hjM1Qsuvvl020nbmW3lY7zZXswNwMK3ZO RUxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+lyLVjEDcCmHazDWRuGxSuP3x/WTn0GZt6pNizNjjRc=; b=o2JU5Os/i0GqceO1pWZ2LPwScal0FLdgaG/z4Z9JxGzRSyeW7QFbZBcZYv/GdQ1Cjj 4KMcScC8xxN4CI987ab1hFp33lGUYoddMJ+AlGxc3cYf1RbcjR+JDyTwTQzkS8A2wvQN Cu6hnn5OYR/nRW2uE/7atnfZW2Erw4/pmJiisUkRHpxqmcixNdqyfOQUXFjkAv6xbOyW C1W0Ujk65U2OwQn//cDM9toHdFzzYMYaVGrO362pIBlQ3oomW923jpculra5HOWoTTsc /v4KhDYv7X3Zzx0gVu6Sk6s2lMteT3C0owCn12XZurbW4wOoPTjl16Vc6cA3HVfyyyh8 YhfA== X-Gm-Message-State: AKGB3mLi9q7apgDhvEnGth8VqxFlFHG+J5uFGAlEO6S85/ALfX12sQKX n0hj09CbY4mCVuTcOVBg01o= X-Google-Smtp-Source: ACJfBovxwLjYqkDBN2Y3s9kSTwd4SyXaQkZ4Sy7wEeet+8oz3w1ws7FYNXdaOxCJ9Df9RjGrnPrn+Q== X-Received: by 10.223.179.215 with SMTP id x23mr2719698wrd.137.1515010406797; Wed, 03 Jan 2018 12:13:26 -0800 (PST) Received: from Red.local (LFbn-1-6953-20.w90-116.abo.wanadoo.fr. [90.116.134.20]) by smtp.googlemail.com with ESMTPSA id p90sm1800627wmf.3.2018.01.03.12.13.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jan 2018 12:13:26 -0800 (PST) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180103_201338_634779_0B9DE58E X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, fabien.dessenne@st.com, virtualization@lists.linux-foundation.org, Corentin Labbe , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch convert the stm32-hash driver to the new crypto engine API. Signed-off-by: Corentin Labbe Tested-by: Fabien Dessenne --- 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;