Received: by 10.192.165.148 with SMTP id m20csp3623143imm; Mon, 23 Apr 2018 09:30:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+U8irmQIhTU8lCMS1BLpaXXhO7ADNx0ShUCTqTKUYiP4xMXclucb46tUGgQyrZaqG4KWbf X-Received: by 2002:a17:902:a50d:: with SMTP id s13-v6mr21192717plq.228.1524501047614; Mon, 23 Apr 2018 09:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524501047; cv=none; d=google.com; s=arc-20160816; b=XHMXVeMbgWv3/3h+npK5KjguX15nSeAUT7LMrlLfaI6Xu88Ggo3PMM4AkCwnb6nhCy CZF0bRn/3bIQ9HoBOmH63SVn2G/1CzREn+tmd9ybkNkRowCuRfvdN8YOlCto30dlVEYZ I8/PPJwBR378oyyLbPpk2fQXBq6sLISPF9eBSKNek13PNVHp3AL6RnsGnEV8cAa9pMV5 3NPJ5HiuzhFXJRGFI9MXQ1g1H63MvRDONOXm8kfdGbvqdaimlCSsUQ7Xi520dALqNB7H iMs0plbQvyF3Dik2hfx2WQU5gTo2LEd+uR8zKL4VBFdRrug+gfJAO5+SC+9+eIpAdKgq 9o5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=o1y+mo+WLeNt+RQRMrXAIRKAsWI9V6MathBPbxoffW0=; b=r0XFhKFOoSD9Pw2J3MT6/eXMbetbyWZtbVuqpY4OXI9X+vSEK0vsUB7iLn6rx8E6+N 1IsPxmYWdBAH8NLqzjc7FxYrcanF8fHeagDVLFEh6OunGzdQxyUsrwbnp7w0+Ls/alR/ 1IovXVYQ/+UKPVUd4zLS3xwq1OSbLzKTUD8EvVZIwkWgqTomWepHUb9GjPuP2d0tVHfH H91gcB7DCRNqHNapVRidvRCzY2dJHiWlkn+b4oK2G/tZMECw7sMpwxJVC8TAJZGoltVK OOUNBTStWEC+4510ScMdV69UcitZ9SbYvoGVVz2kFW4DDeFMrOr0icGmSKARacCr9FML FUQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 e1-v6si11873563pld.69.2018.04.23.09.30.32; Mon, 23 Apr 2018 09:30:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755835AbeDWPLv (ORCPT + 99 others); Mon, 23 Apr 2018 11:11:51 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:43272 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755352AbeDWPLi (ORCPT ); Mon, 23 Apr 2018 11:11:38 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3NF9ZuZ011460; Mon, 23 Apr 2018 17:11:03 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2hfv6ek6my-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 23 Apr 2018 17:11:03 +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 7995638; Mon, 23 Apr 2018 15:11:02 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 595634A96; Mon, 23 Apr 2018 15:11:02 +0000 (GMT) Received: from SAFEX1HUBCAS21.st.com (10.75.90.44) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 23 Apr 2018 17:11:02 +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.361.1; Mon, 23 Apr 2018 17:11:02 +0200 From: Lionel Debieve To: Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Rob Herring , , , CC: Benjamin Gaignard , Ludovic Barre Subject: [PATCH 2/2] hwrng: stm32-rng - fix pm_suspend issue Date: Mon, 23 Apr 2018 17:04:26 +0200 Message-ID: <20180423150426.22198-3-lionel.debieve@st.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180423150426.22198-1-lionel.debieve@st.com> References: <20180423150426.22198-1-lionel.debieve@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.65] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-23_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When suspend is called after pm_runtime_suspend, same callback is used and access to rng register is freezing system. By calling the pm_runtime_force_suspend, it first checks that runtime has been already done. Signed-off-by: Lionel Debieve --- drivers/char/hw_random/stm32-rng.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 0d2328da3b76..042860d97b15 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -187,8 +187,13 @@ static int stm32_rng_runtime_resume(struct device *dev) } #endif -static UNIVERSAL_DEV_PM_OPS(stm32_rng_pm_ops, stm32_rng_runtime_suspend, - stm32_rng_runtime_resume, NULL); +static const struct dev_pm_ops stm32_rng_pm_ops = { + SET_RUNTIME_PM_OPS(stm32_rng_runtime_suspend, + stm32_rng_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) +}; + static const struct of_device_id stm32_rng_match[] = { { -- 2.15.1