From patchwork Mon Apr 8 07:41:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Debieve X-Patchwork-Id: 10888925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A01AC1669 for ; Mon, 8 Apr 2019 07:43:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 839DE26E7B for ; Mon, 8 Apr 2019 07:43:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77679271CB; Mon, 8 Apr 2019 07:43:55 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 F339626E7B for ; Mon, 8 Apr 2019 07:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9t4NSRvTPCtQ0yMRHKMbv69/mP/zlHF0rwbQ3dvFydc=; b=PYVp0PbtaU91Iu Jmxywm/nDPEfL6IDrNYDFxRQCsLpfTP8paz8yshb+zN4lo36swWmPOORopbJ1DkxJUjyD51gUkfzc geeENedekezW9Ex+Me2+6is1M1HbPT+NCSdyt9vG/Kfobr48qE65sdW/p6aUPZ/K6Pz7E8MUAhlA9 Ubo5lEoL44DTvRfGz034lhJrF9Zlh58KXIFXPZtT7cRXafxj+s3RkuUVWdh4U1CtesI7P6buvGm1s KcmdPaPeR8zC+n6dJ3WiI/Ma8dioioGOEIdGOYdkiVxufTTNCg6ajOEwx7YNaT3HPjRwmBEh9pXIc nppvDLh22Ob358ywJKYA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDOwZ-0003qn-GR; Mon, 08 Apr 2019 07:43:51 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hDOv4-0001kT-Bd for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2019 07:42:56 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x387bVNi016730; Mon, 8 Apr 2019 09:42:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=mzgL90xy/Z18CpzSweHDi9oQPt1aVLICyetmISiGRGQ=; b=sjBhBHk9OxbLO9LyUd9VeNj5y2fc3lJof9vc/0E/va6r3H+2wyME2Eu8NXIOXsdbTjIs lLMGbuytQOTHBgLnMMPpUDHhPXmhANmI0ibrgOk5j+6CpJWyTIHZAj6qE3MyO9eWxlDJ U3RKU73FDof5UukZ/X5zlK9lDb8fWyE7TUPUgDUjyGM5Ff4L8PXoJS2qJglcXN7sBRLn 6TZECxLxYMd1bggwRn+1217xjEbBJD0/lS4YK95KgWyWnf4FHEvALhOYHmejlPa7FZIJ qMOFQYqLTO/jefnMT17lqOxpi/BajbVdwJYFX1u/HmYHmnhBir6V8Tin9Is1SvLMEgss jA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2rprcf1jfg-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 08 Apr 2019 09:42:01 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E951738; Mon, 8 Apr 2019 07:41:59 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9BC5512E1; Mon, 8 Apr 2019 07:41:59 +0000 (GMT) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 8 Apr 2019 09:41:59 +0200 Received: from localhost (10.201.23.65) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 8 Apr 2019 09:41:58 +0200 From: Lionel Debieve To: Herbert Xu , "David S . Miller" , Maxime Coquelin , "Alexandre Torgue" , , , Subject: [PATCH 1/1] crypto: stm32/hash - Fix self test issue during export Date: Mon, 8 Apr 2019 09:41:58 +0200 Message-ID: <1554709318-25389-1-git-send-email-lionel.debieve@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.201.23.65] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-08_04:, , signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190408_004219_348527_3809ADCD X-CRM114-Status: GOOD ( 13.32 ) 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: Ludovic Barre , Benjamin Gaignard , Fabien Dessenne , linux-stm32@st-md-mailman.stormreply.com 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 Change the wait condition to check if the hash is busy. Context can be saved as soon as hash has finishing processing data. Remove unused lock in the device structure. Signed-off-by: Lionel Debieve --- drivers/crypto/stm32/stm32-hash.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index 4a6cc8a..bfc49e6 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -181,8 +181,6 @@ struct stm32_hash_dev { u32 dma_mode; u32 dma_maxburst; - spinlock_t lock; /* lock to protect queue */ - struct ahash_request *req; struct crypto_engine *engine; @@ -977,7 +975,7 @@ static int stm32_hash_export(struct ahash_request *req, void *out) pm_runtime_get_sync(hdev->dev); - while (!(stm32_hash_read(hdev, HASH_SR) & HASH_SR_DATA_INPUT_READY)) + while ((stm32_hash_read(hdev, HASH_SR) & HASH_SR_BUSY)) cpu_relax(); rctx->hw_context = kmalloc_array(3 + HASH_CSR_REGISTER_NUMBER,