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: 123337 Delivered-To: patch@linaro.org Received: by 10.80.135.92 with SMTP id 28csp5926440edv; Wed, 3 Jan 2018 12:25:11 -0800 (PST) X-Google-Smtp-Source: ACJfBovAmZ5wZXkg2kczAROsuWD0QRdiHUlHDCzhpyXS/X3pgXAa1CweMGQCF2q5QPcBWB1b8fIL X-Received: by 10.84.235.204 with SMTP id m12mr2445389plt.84.1515011111730; Wed, 03 Jan 2018 12:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515011111; cv=none; d=google.com; s=arc-20160816; b=lqQPAQWzSA+2dHryg46ihQ64RzuvSBl6tGxq83Ibk9GryUtriGf7j6XQwIBmvhHQwj u5gcWUHr/oy5gKfNSvQgE69+pWYH8uHxDGFxeBDuFI+QebMTIQzb+qO+0gr42NUD6XVy 7epZFfM8q82Hz7EtiT7tRjZsrwO9VB8PJi/HtMjJqP8W7yRiI4ZyWk0b7wrH0QPK6Ldw DwhYh5PCSvsq1xHMgFFQw3IlbgVOADwCB3KK+I7bVNIK1f3W5WUaazbrdTCh9Q1VTf4B rMujHGLQzHcBEGXRuGK2MzGAhAMtsrOLeibwmPz5DLDDpvVDMVJrJxX77LMsoD+Kf49M QBeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+lyLVjEDcCmHazDWRuGxSuP3x/WTn0GZt6pNizNjjRc=; b=iYAJ3sqJtQ+8FO2bUkuS0tzYnFHBSg6MbF8KII8pZqMSfNYRWltAXNG+FQ26o1PD+T 0yuUuVquq2BnHV4M1YxcWQORfOxr4XktBbE6EvaDsCoOezVx4ha/nkStymHgfK4maauq x8xU3T/O/7sPk1jvxDFeKhCyBPIwBwzuaBXLGHWYsH8x6NAlwY/ujZLxftvwXQtsij7q EVCBxUh6E937jH8GvpwD3pEnX7eKxrP5zouzWsZdjub/mpLS8B5i0/n4GPaYtrU9CwN5 f4z5wE7cBgsUWCfNgqssaEgk6du8VDcNHTd2EuAehzgTURDh78cTfBilawX+9CFCWXNR mdIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XNUkhoWP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3si1130539pld.695.2018.01.03.12.25.11; Wed, 03 Jan 2018 12:25:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XNUkhoWP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbeACUZG (ORCPT + 28 others); 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 Received: by mail-wr0-f196.google.com with SMTP id w107so2841886wrb.9; 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=VKfx+in7gek1VT8K8uaYT1nmu6fQU+6+42qlaciFG7kHhKhtPOqOJh+AZBKH5TUTqm TpB1PW/to0kNi1GCVR4OmVsDebExjXSuNB+LIy233jKGoLshERaz/NFijnfEDkjxmzdX eL3zzmuoGSuE9687n5PoST0KOIrBrA0nK3oeXefxsze/3YCzPCcR9YpK1Mh4Ns0CTM+/ 7xi5219FVPhEla1gPX7thgJr4h7wR935x2vYm5F5kid8nlpUx2NDJWXLMh8gGDNkfPPB wP/S29ljXGBmiI1htkf5TE2da5kq/ZG8le7mLkIh3pQbgUu9/xNJ0ys4TpORjk+vvR7c JVeg== X-Gm-Message-State: AKGB3mLBdgjnggkHaDsVbJG8v5DIL1NthTHAPPos3uNyKjNHaBrVQFtT wbVg2z3axibtnC679farpkY= 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 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.13.6 Tested-by: Fabien Dessenne 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;