From patchwork Thu Dec 22 16:15:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9485245 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 8A9A2600BA for ; Thu, 22 Dec 2016 16:17:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C2AB21BED for ; Thu, 22 Dec 2016 16:17:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 712B228066; Thu, 22 Dec 2016 16:17:00 +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, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0AB7721BED for ; Thu, 22 Dec 2016 16:17:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cK61p-0005Ob-SJ; Thu, 22 Dec 2016 16:15:37 +0000 Received: from smtpout.microchip.com ([198.175.253.82] helo=email.microchip.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cK61h-0004IV-Ad for linux-arm-kernel@lists.infradead.org; Thu, 22 Dec 2016 16:15:29 +0000 Received: from tenerife.corp.atmel.com (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 Dec 2016 09:15:12 -0700 From: Cyrille Pitchen To: , , Subject: [PATCH 01/12] crypto: atmel-sha: create function to get an Atmel SHA device Date: Thu, 22 Dec 2016 17:15:06 +0100 Message-ID: <2557968ceb904a9a73dc83a3639e9f11f54a643b.1482422983.git.cyrille.pitchen@atmel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFupiVWLjYuHi8mHRFfwTHWHQc2POG16LwwunMFo8eN/JYjFt+jtmi3uftjFadExZxeTAGsAQxZqZl5RfkcCa8e7XbJaC29wVkzqiGhjfcXYxcnEICaxnlOjo3s7axcjJwSZgKPH2wVEwW0QgUGJhyytGkCJmgemMEg9Wv2MHSQgLhEjsaFvCAmKzCKhKbF+3AczmFYiX+Ny0nBHElhCQk7h5rpMZxOYUsJV4fPce2FAhARuJ/yvvskLUC0qcnPkErJdZQELi4IsXzBA1akCLVzBDzAmUeLFpM5TtJPF83U02CNtO4vD0i+wQtoNE14LfcDVPH1+EsrUltr/axwph60hsO9jPAmHbSuyZMZEJwnaXePBoOZTtKzHrYQNUTZRE25LNbBMYJWYhOXUWklMXMDKtYpR29vDTDQ7TdY1w9jAw18tNzijQzU3MzNNLzs/dxAiJp5wdjJMn+R9ilORgUhLl3TrpfLgQX1J+SmVGYnFGfFFpTmrxIUYJDh4lEV7+ZUA53uKCxNzizHSYlAwHh5IE7+OlQCnBotT01Iq0zJyS1CKI9ClGSSlx3o8gSQGQvozSPLjcJUZRKWHeKJAcT0FqUW5mCUT8FqMwx0MmIZa8/LxUKaATGYBAg/EVozgHo5IwrzTIDTyZeSVwJ7wCuo4J6Lp1u0+DXFeSiJCSamA8YmKbHqP9dOnq255z0qvjl+1jiVcLOd9veHF+9tQvSywrOK/33Vn21PNJv6ns4d43Vzwm7JsbPvGkuMFLhZsml45t2TB9osL+j+ueLJqw5vvctw+2mweuO+2q8n9fZcjXEOfo7qKnMrsDnPO+BV7geb/lx3rjlNCAGS8n6u/KSPfbdPMff8IKJyWW4oxEQy3mouJEAPXgUSodAwAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161222_081529_456395_E5545930 X-CRM114-Status: UNSURE ( 9.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cyrille Pitchen , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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 is a transitional patch: it creates the atmel_sha_find_dev() function, which will be used in further patches to share the source code responsible for finding a Atmel SHA device. Signed-off-by: Cyrille Pitchen --- drivers/crypto/atmel-sha.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 97e34799e077..33a36e667547 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -260,11 +260,8 @@ static void atmel_sha_fill_padding(struct atmel_sha_reqctx *ctx, int length) } } -static int atmel_sha_init(struct ahash_request *req) +static struct atmel_sha_dev *atmel_sha_find_dev(struct atmel_sha_ctx *tctx) { - struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); - struct atmel_sha_ctx *tctx = crypto_ahash_ctx(tfm); - struct atmel_sha_reqctx *ctx = ahash_request_ctx(req); struct atmel_sha_dev *dd = NULL; struct atmel_sha_dev *tmp; @@ -281,6 +278,16 @@ static int atmel_sha_init(struct ahash_request *req) spin_unlock_bh(&atmel_sha.lock); + return dd; +} + +static int atmel_sha_init(struct ahash_request *req) +{ + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); + struct atmel_sha_ctx *tctx = crypto_ahash_ctx(tfm); + struct atmel_sha_reqctx *ctx = ahash_request_ctx(req); + struct atmel_sha_dev *dd = atmel_sha_find_dev(tctx); + ctx->dd = dd; ctx->flags = 0;