Received: by 10.223.176.46 with SMTP id f43csp1069352wra; Fri, 26 Jan 2018 11:19:36 -0800 (PST) X-Google-Smtp-Source: AH8x224gfZhJf4ab10m16JfVba7CAH+S11kqwEmh5d03PC9uEYke5nDQgWvtw2Robut/2rTU8d1h X-Received: by 10.101.74.71 with SMTP id a7mr16557257pgu.32.1516994376482; Fri, 26 Jan 2018 11:19:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516994376; cv=none; d=google.com; s=arc-20160816; b=RebqIKyeZZ612G7n4l1NtozkDa9lKU0xiEAWn0qZt16EeEhawlUMNt1hH1nDWZQMtr m8acxiVMIldy0YD0oiWKsvlRHFrasBNC6yGxJydFPGhB98wH8vDnCbK/cVoimzMHN8Je gO6CGc7n8o6yF0tbpZ3bckLTS2jOubtHNfoG+bD2qhCR+cbuGVVdis5FTEQHMZ3pBes0 n4nbRs3zI3+FrSUb6je+z3muJKWyudYeg8mjrmHCZq6RKGcRrVpmorLiEUUeQ5STt4cQ LZPcNBjEK43Q/7TK1Iy1f8GRoH9SUUYA+7jfJFuchbeNzChvIPcO6SAHZK7esyhplrYA fkAQ== 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=g8IfwhVYNUEUgKu85ioBXaFL9OKO9rWTugBCJeqpULU=; b=pUk2fgZrP9truyThzTQUdUT0S5WQlfr+4X8SB1XCBtcnxPnwyZKG2QyzYf0JE7hZub DwhvmdRfZtp0CVxzXMS+2p6odn9pKKRL6QA8OqmWnuTPhinin1mCnFGX3lyJosvInSrg 0iCd3alsEDS1239NRQc4yxpQTe9GgQAwgMlRo7wrIJKD18UWMFOSMZ3E3gi5NQ3BUFen cpH/JeI0ocsmrxLsFolNk0sE1vDLU5+ACb1Kfp/dJkBj+zZ5tnsfOE7QF34+lookkHUD vt9S4vK2TPXJH7737WZcdygVkj/wwrEUrOVRPlfXW6qANDjTQd6LebCuqJimawiw5HRd GYFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nswL9Mro; 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 b61-v6si4099855plc.265.2018.01.26.11.19.22; Fri, 26 Jan 2018 11:19:36 -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=nswL9Mro; 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 S1753012AbeAZTSp (ORCPT + 99 others); Fri, 26 Jan 2018 14:18:45 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:45205 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751971AbeAZTSP (ORCPT ); Fri, 26 Jan 2018 14:18:15 -0500 Received: by mail-wr0-f196.google.com with SMTP id 16so1387692wry.12; Fri, 26 Jan 2018 11:18:14 -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=g8IfwhVYNUEUgKu85ioBXaFL9OKO9rWTugBCJeqpULU=; b=nswL9MroZZP0DFWZFFITp0rrNf9+Uwi01z4Tdi4OxstzjBrWFBfvQp/lZkqlYe1rNG /MJGhUoxFSYkLK7H5/2Cn0D37KCVhwW3JkZhipRJ0yFJ5GwupUy0TfLqZII3lrkot3bO 9vwCbI6uQLmWX0dU0qiAmKBqVnO/HFivil0pM5dr3mnF44rcYy7U8W6XCBWw5btIbgdV +c1Wb1+eqgB395hG8tvQAkIjtMiVYYnha3z6VuvlaR71u0V8Lrrx+c1IHNwG2buF5/cR XlpX4gfSRtb5ZVJwTBjNj6nPRLC3prAQlW7DVzSZSaZsRLJW73v0ArLxbBAfWhpcXd39 xUtg== 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=g8IfwhVYNUEUgKu85ioBXaFL9OKO9rWTugBCJeqpULU=; b=YPkZ7iREgXIRJQzs5taUKmR0ZjfoqdcRe6ex2GD70+jG6QZJefDbk0NV+dUZlyNNeH DjTlzx7DAEtJGaPQPgn0pkpRa02gKQn8i+S0BqWkyymwpXPwn0cyWzkVQpR1q7vtfvPM LRsaD2I8ku7D5iV/7NuyckWvJZLmkSPh2U2+0U6NBSc3Y9H+HZ5j4+dAOyHrJ8KdhAOV foyQk21VgC34xjoWbLNg7zu3+5Q7+PdkU7as1rS5NeqgCsKB6WF6X155368F3/1ir62m PHAx+/oCe/WJ6wGS7BmrxvTgeMTzHAr57L4bBDw/B8ErlxT+gPx672R5JR7bS9aPV/C4 CCvA== X-Gm-Message-State: AKwxytfCH2EtoRnl1wxmsnqX1cHrVYSRPGCK/uBW727WIQ/gyEvTi9XL BWuPYeglveoow9FlOqVlUKA= X-Received: by 10.223.165.25 with SMTP id i25mr13548589wrb.127.1516994293550; Fri, 26 Jan 2018 11:18:13 -0800 (PST) Received: from Red.local (LFbn-MAR-1-494-174.w2-15.abo.wanadoo.fr. [2.15.82.174]) by smtp.googlemail.com with ESMTPSA id k125sm7587510wmd.48.2018.01.26.11.18.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 11:18:12 -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, fabien.dessenne@st.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, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v2 5/6] crypto: stm32-hash: convert to the new crypto engine API Date: Fri, 26 Jan 2018 20:15:33 +0100 Message-Id: <20180126191534.17569-6-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180126191534.17569-1-clabbe.montjoie@gmail.com> References: <20180126191534.17569-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 Tested-by: Fabien Dessenne --- drivers/crypto/stm32/stm32-hash.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index 4ca4a264a833..89b0c2490d80 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_ctx enginectx; struct stm32_hash_dev *hdev; unsigned long flags; @@ -828,15 +829,19 @@ 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) { return crypto_transfer_hash_request_to_engine(hdev->engine, req); } -static int stm32_hash_prepare_req(struct crypto_engine *engine, - struct ahash_request *req) +static int stm32_hash_prepare_req(struct crypto_engine *engine, 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; @@ -854,9 +859,10 @@ static int stm32_hash_prepare_req(struct crypto_engine *engine, return stm32_hash_hw_init(hdev, rctx); } -static int stm32_hash_one_request(struct crypto_engine *engine, - struct ahash_request *req) +static int stm32_hash_one_request(struct crypto_engine *engine, 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 +1039,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 +1502,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