From patchwork Thu Dec 22 16:15:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 9485255 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 78D19600BA for ; Thu, 22 Dec 2016 16:17:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A59821BED for ; Thu, 22 Dec 2016 16:17:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ECC22808C; Thu, 22 Dec 2016 16:17:25 +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=unavailable 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 11D1521BED for ; Thu, 22 Dec 2016 16:17:25 +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 1cK629-0005Ui-OA; Thu, 22 Dec 2016 16:15:57 +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 1cK61j-0004IV-T9 for linux-arm-kernel@lists.infradead.org; Thu, 22 Dec 2016 16:15:33 +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:22 -0700 From: Cyrille Pitchen To: , , Subject: [PATCH 03/12] crypto: atmel-sha: make atmel_sha_done_task more generic Date: Thu, 22 Dec 2016 17:15:08 +0100 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFupiVWLjYuHi8mHRlfoTHWHwfdHcN7wWhxdOYbR48L6TxWLa9HfMFvc+bWO06JiyismBNYAhijUzLym/IoE149O27cwFvUIVu9buZm9gvMfXxcjFISSwnlHiePtvli5GTg42AUOJtw+OsoLYIgKBEgtbXjGCFDELTGeUeLD6HTtIQljAX2L6xKtMIDaLgKrEs29ngJo5OHgF4iWWblMGCUsIyEncPNfJDGJzCthKPL57D2ymkICNxP+Vd8FsXgFBiZMzn4DtZRaQkDj44gUzRI0a0N4VzBBzAiV+v2tihLCdJJ6vu8kGYdtJHJ5+kR3CdpDoWvCbGabm6eOLULa2xPZX+1ghbB2JbQf7WSBsW4k9MyYyQdjuEg8eLYeyfSVmPWyAqomSaFuymW0Co8QsJKfOQnLqAkamVYzSzh5+usFhuq4Rzh4G5nq5yRkFurmJmXl6yfm5mxgh8ZSzg3HyJP9DjJIcTEqivFsnnQ8X4kvKT6nMSCzOiC8qzUktPsQowcGjJMLLvwwox1tckJhbnJkOk5Lh4FCS4H28FCglWJSanlqRlplTkloEkT7FKCklzvsRJCkA0pdRmgeXu8QoKiXMGwWS4ylILcrNLIGI32IU5njIJMSSl5+XKgV0IgMQaDC+YhTnYFQS5pUGuYEnM68E7oRXQNcxAV23bvdpkOtKEhFSUg2M+iuLTOMfmc377Murxrg3Izm7ca1WhZ3dfaZNrMfc7vXLHtX1O/E8eVaAD+e5pLra2UfsdYvmH+ApED/2/XdeWfvJYsOtivUPKmV+JT54PXNfbIr8zzUW21rNJ508czZQ+kRa7A7xqxV6TcK12QxP3W7eFHzKWGY1ZbOL1p+t6qz25jeMZFKVWIozEg21mIuKEwEKkuXjHQMAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161222_081532_047110_B57BF577 X-CRM114-Status: GOOD ( 12.22 ) 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 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)