Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: lionel.debieve@st.com (Lionel Debieve)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] hwrng: stm32-rng - fix pm_suspend issue
Date: Mon, 23 Apr 2018 17:04:26 +0200	[thread overview]
Message-ID: <20180423150426.22198-3-lionel.debieve@st.com> (raw)
In-Reply-To: <20180423150426.22198-1-lionel.debieve@st.com>

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 <lionel.debieve@st.com>
---
 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

  parent reply	other threads:[~2018-04-23 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 15:04 [PATCH 0/2] Fix stm32-rng for default state and suspend Lionel Debieve
2018-04-23 15:04 ` [PATCH 1/2] hwrng: stm32 - define default state for rng driver Lionel Debieve
2018-04-23 15:04 ` Lionel Debieve [this message]
2018-05-05  7:16 ` [PATCH 0/2] Fix stm32-rng for default state and suspend Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180423150426.22198-3-lionel.debieve@st.com \
    --to=lionel.debieve@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox