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: 9539639 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 5A5E560429 for ; Thu, 26 Jan 2017 16:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A11026E96 for ; Thu, 26 Jan 2017 16:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EED827D4D; Thu, 26 Jan 2017 16:13:10 +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=unavailable 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 97DD926E96 for ; Thu, 26 Jan 2017 16:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbdAZQNF (ORCPT ); Thu, 26 Jan 2017 11:13:05 -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 S1752158AbdAZQNE (ORCPT ); Thu, 26 Jan 2017 11:13:04 -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:09:36 -0700 From: Cyrille Pitchen To: , , CC: , , , , Cyrille Pitchen 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= 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 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)