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: 161929 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3383059jan; Mon, 8 Apr 2019 00:43:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzf936IqsrTngFw480juwqXpt1ToBJ82jJZ5InxRQBmfiWch3sC9xOuMbyR8EfsHDtAxUId X-Received: by 2002:a62:304:: with SMTP id 4mr27846731pfd.99.1554709380193; Mon, 08 Apr 2019 00:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554709380; cv=none; d=google.com; s=arc-20160816; b=dIsrACK4Qi/0OmXPpN5n8Kosh3HqgpEGInXvLbOklV8YEbJypQMcXH4YpANr8bI4dl 2js8FRM0SnhOatUHscg/UFa7/hbhDDwL7JC2UFXuKcY0gC9au2gEhDVQAtp4/0CyNAdq kQ4Vh5rqfBonz7tNwls/lV1pc+Iie4cjdd+KEcCkWDMEsboV7p7LvX/pi+36Y+E9qx2M h8oHYKjxW3tG6OIRrl3LQY5kQRYrNf+FOA88YIAoa4FKpaMAzQDegMdLCtMPsGh1NC35 LDyoZgTFmHowfhD/H4VDjxdkegu/qs0RUMSfiCbfVZ/gI7MsJc3XtqLG+sskA9vSa9j3 e5hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=mzgL90xy/Z18CpzSweHDi9oQPt1aVLICyetmISiGRGQ=; b=hJTmIGlg0ODU6oGwFyn+qPdwFn8JweQWvVwKwnn/pPVPDV0DsauT5tt44W4l2hGSap tC7d1mV3pQeUUxgpn+VFSBzRgI8Fums/6/nsYlFnDx7uM151lOTw8IfrzVR8SY7koGWN JOpox+Z0hp4pHn9oZpC848uTj/KybJJyZPJts9pyrC3pK3Sp3EZwXySm+8uSZ3H4Yvmq R9gJ1LkW242+kdsS+nlqkWpdyanZkOD/Y63SPBIVxkFlJ6qioL8TGLd9jNq/37wkcWOc gScnoqMsHAfqDf4k08nlesWEo+KKzJyYrG0XR07TGq3rYTsP3QcXAKgzNWUMB/vmtHIX 1uTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=sjBhBHk9; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4si21217027pgc.298.2019.04.08.00.42.59; Mon, 08 Apr 2019 00:43:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=sjBhBHk9; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725877AbfDHHm6 (ORCPT + 3 others); Mon, 8 Apr 2019 03:42:58 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:11846 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725871AbfDHHm6 (ORCPT ); Mon, 8 Apr 2019 03:42:58 -0400 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" , , , CC: Benjamin Gaignard , Fabien Dessenne , Ludovic Barre , 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 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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(-) -- 2.7.4 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,