From patchwork Thu Jan 26 16:07:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9539665 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 D24C160429 for ; Thu, 26 Jan 2017 16:14:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C193D26E96 for ; Thu, 26 Jan 2017 16:14:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B45F927D4D; Thu, 26 Jan 2017 16:14: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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EE7526E96 for ; Thu, 26 Jan 2017 16:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753413AbdAZQOr (ORCPT ); Thu, 26 Jan 2017 11:14:47 -0500 Received: from smtpout.microchip.com ([198.175.253.82]:35469 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752171AbdAZQOn (ORCPT ); Thu, 26 Jan 2017 11:14:43 -0500 Received: from tenerife.corp.atmel.com (10.10.76.4) by chn-sv-exch06.mchp-main.com (10.10.76.107) with Microsoft SMTP Server id 14.3.181.6; Thu, 26 Jan 2017 09:08:27 -0700 From: Cyrille Pitchen To: , , CC: , , , , Cyrille Pitchen Subject: [PATCH v3 01/12] crypto: atmel-sha: create function to get an Atmel SHA device Date: Thu, 26 Jan 2017 17:07:46 +0100 Message-ID: <952192a522f455e6b066b8e542a446764064869f.1485443478.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+NgFjrEKsWRWlGSWpSXmKPExsXCxeXDovtHrivCYH1r33Fei3vfzzNbzDnfwmLR/UrGYtPja6wW9+/9ZLK4vGsOm8W3y83sFlNPr2Vx4PBY8Gsri8enK1eYPLasvMnkse2AqsfmJfUenzfJBbBFsWbmJeVXJLBmvPs1m6XgNnfFpI6oBsZ3nF2MXBxCAusZJS7de8LexcjJwSZgKPH2wVFWEFtEIFBiYcsrRpAiZoF1jBItzW+ZQRLCAuESvZf3M4LYLAKqEksWXWIBsXkF4iUu9j8Dq5EQkJO4ea4TzOYUsJVY+Ws1G4gtJGAj0X3nLSNEvaDEyZlPwHqZBSQkDr54wQxRowa0eAXUnECJZ40NrBC2k8T/lTPZIWw7icPTL0LZDhL3789gg6k5uPU5lK0tsf3VPqheHYltB/tZIGxbiT0zJjJB2O4SDx4th7J9JWY9bICqiZI41f+ZdQKjxCwkp85CcuoCRqZVjNLOHn66wWG6rhHOHgZmernJGQW6uYmZeXrJ+bmbGCERmr2D8cj8iEOMkhxMSqK8N7U7I4T4kvJTKjMSizPii0pzUosPMcpwcChJ8IbKdkUICRalpqdWpGXmAFMFTJqJg/MQowQHj5IIbwZIDW9xQWJucWY6RP4Uo6SUOG+4DFBCACSRUZoH13uJUVRKmPe0KFCOpyC1KDezBCJ+i1GY4yGTEEtefl6qFNCdDECgwfiKUZyDUUkYYglPZl4J3I5XQOuZgNZfYG4HWV+SiJCSamDcsCq9VibvFPcKF5fGzr0m1rIhm18lCpjctZCVbek13eM7s0n9yrKmQh1fqXBBvdssD5Zl71V6f0+w8uyCG+sbL3s1L3AvMStZeaFaI0Opk5spZYtV5mK+n9xXrDkWOXnc9A3ZddVgruM1VZNrmYeMph1USb3y661MJUvoB+sp22bXW0+rWa/EUpyRaKjFXFSc CAA0acvlVQMAAA== Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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;