From patchwork Thu Jan 26 16:07:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9539631 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 8836A60429 for ; Thu, 26 Jan 2017 16:10:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74E6E26E77 for ; Thu, 26 Jan 2017 16:10:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67B8427D4D; Thu, 26 Jan 2017 16:10:32 +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=-1.9 required=2.0 tests=BAYES_00 autolearn=ham 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 EB09826E77 for ; Thu, 26 Jan 2017 16:10:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cWmcy-0006Du-OQ; Thu, 26 Jan 2017 16:10:24 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWmca-00066l-Es for linux-arm-kernel@bombadil.infradead.org; Thu, 26 Jan 2017 16:10:00 +0000 Received: from smtpout.microchip.com ([198.175.253.82] helo=email.microchip.com) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWmcZ-0006jx-BM for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2017 16:09:59 +0000 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:09:36 -0700 From: Cyrille Pitchen To: , , Subject: [PATCH v3 03/12] crypto: atmel-sha: make atmel_sha_done_task more generic Date: Thu, 26 Jan 2017 17:07:48 +0100 Message-ID: <5989b03be520fc8e0f420fde675ced47ba0d33dc.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+NgFjrMKsWRWlGSWpSXmKPExsXCxeXDousg3xVh0D1r0nFei3vfzzNbzDnfwmLR/UrGYtPja6wW9+/9ZLK4vGsOm8W3y83sFlNPr2Vx4PBY8Gsri8enK1eYPLasvMnkse2AqsfmJfUenzfJBbBFsWbmJeVXJLBmfNq2nbmgV6hi19rd7A2M9/i6GLk4hATWM0r0bbzB2MXIycEmYCjx9sFRVhBbRCBQYmHLK0aQImaBdYwSLc1vmUESwgJBEm2X77GB2CwCqhK/7q9jAbF5BeIl3s7+D9YsISAncfNcJ1g9p4CtxMpfq8HqhQRsJLrvvGWEqBeUODnzCVgvs4CExMEXL5ghatSAFq9ghpgTKNH79SfUTCeJ/ytnskPYdhKHp1+Esh0k7t+fwQZTc3DrcyhbW2L7q31QvToS2w72s0DYthJ7ZkxkgrDdJR48Wg5l+0rMetgAVRMlcar/M+sERolZSE6dheTUBYxMqxilnT38dIPDdF0jnD0MzPRykzMKdHMTM/P0kvNzNzFCYjR7B+OR+RGHGCU5mJREeW9qd0YI8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuANle2KEBIsSk1PrUjLzAEmC5g0EwfnIUYJDh4lEd4MkBre4oLE3OLMdIj8KUZJKXHecBmghABIIqM0D673EqOolDDvaVGgHE9BalFuZglE/BajMMdDJiGWvPy8VCmgOxmAQIPxFaM4B6OSMMQSnsy8Ergdr4DWMwGtv8DcDrK+JBEhJdXAOMm5texW9C69g9NbrfP0nJmUlKM3MQoKKOc0Tp7b2nyi+V7ajLsPf6zIjPjDs2JJ8NetSZz6uTJCAay9V/33zOPcotmmOfm3EtvB/NikWeZ2+9iZ9rqfP2x4jLuYU69iDaPAtiPHuP/4P+X8eYpT/PFDX+bqTSxPDl7juPOvNu5lvYKt74kqJZbijERDLeai 4kQAwWGJllYDAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170126_110959_556093_2BE9F4FB X-CRM114-Status: GOOD ( 12.62 ) 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: smueller@chronox.de, 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 patch is a transitional patch. It updates atmel_sha_done_task() to make it more generic. Indeed, it adds a new .resume() member in the atmel_sha_dev structure. This hook is called from atmel_sha_done_task() to resume processing an asynchronous request. Signed-off-by: Cyrille Pitchen --- drivers/crypto/atmel-sha.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 2dbed8bb8d26..643d79a05dda 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -138,6 +138,7 @@ struct atmel_sha_dev { struct crypto_queue queue; struct ahash_request *req; bool is_async; + atmel_sha_fn_t resume; struct atmel_sha_dma dma_lch_in; @@ -946,6 +947,8 @@ static int atmel_sha_handle_queue(struct atmel_sha_dev *dd, return (start_async) ? ret : err; } +static int atmel_sha_done(struct atmel_sha_dev *dd); + static int atmel_sha_start(struct atmel_sha_dev *dd) { struct ahash_request *req = dd->req; @@ -960,6 +963,7 @@ static int atmel_sha_start(struct atmel_sha_dev *dd) if (err) goto err1; + dd->resume = atmel_sha_done; if (ctx->op == SHA_OP_UPDATE) { err = atmel_sha_update_req(dd); if (err != -EINPROGRESS && (ctx->flags & SHA_FLAGS_FINUP)) @@ -1215,13 +1219,10 @@ static void atmel_sha_queue_task(unsigned long data) atmel_sha_handle_queue(dd, NULL); } -static void atmel_sha_done_task(unsigned long data) +static int atmel_sha_done(struct atmel_sha_dev *dd) { - struct atmel_sha_dev *dd = (struct atmel_sha_dev *)data; int err = 0; - dd->is_async = true; - if (SHA_FLAGS_CPU & dd->flags) { if (SHA_FLAGS_OUTPUT_READY & dd->flags) { dd->flags &= ~SHA_FLAGS_OUTPUT_READY; @@ -1245,11 +1246,21 @@ static void atmel_sha_done_task(unsigned long data) goto finish; } } - return; + return err; finish: /* finish curent request */ atmel_sha_finish_req(dd->req, err); + + return err; +} + +static void atmel_sha_done_task(unsigned long data) +{ + struct atmel_sha_dev *dd = (struct atmel_sha_dev *)data; + + dd->is_async = true; + (void)dd->resume(dd); } static irqreturn_t atmel_sha_irq(int irq, void *dev_id)