linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang7@gmail.com>
To: sre@kernel.org
Cc: baolin.wang7@gmail.com, orsonzhai@gmail.com,
	zhang.lyra@gmail.com, kernel-team@android.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] power: reset: sc27xx: Change to use cpu_down()
Date: Mon,  9 Mar 2020 16:18:45 +0800	[thread overview]
Message-ID: <fadd883957d4283d3149f00ade8e7a7d3fc912b6.1583740881.git.baolin.wang7@gmail.com> (raw)
In-Reply-To: <cover.1583740881.git.baolin.wang7@gmail.com>
In-Reply-To: <cover.1583740881.git.baolin.wang7@gmail.com>

To allow the SC27XX driver can be built as a module, and the
freeze_secondary_cpus() symbol is not exported, thus we can change
to use the exported cpu_down() API to shut down other cpus to avoid
racing, which is same as the freeze_secondary_cpus().

Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
---
 drivers/power/reset/sc27xx-poweroff.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/power/reset/sc27xx-poweroff.c b/drivers/power/reset/sc27xx-poweroff.c
index 2bedd4c..91b5ece 100644
--- a/drivers/power/reset/sc27xx-poweroff.c
+++ b/drivers/power/reset/sc27xx-poweroff.c
@@ -29,10 +29,13 @@
  */
 static void sc27xx_poweroff_shutdown(void)
 {
-#ifdef CONFIG_PM_SLEEP_SMP
-	int cpu = smp_processor_id();
+#ifdef CONFIG_HOTPLUG_CPU
+	int cpu;
 
-	freeze_secondary_cpus(cpu);
+	for_each_online_cpu(cpu) {
+		if (cpu != smp_processor_id())
+			cpu_down(cpu);
+	}
 #endif
 }
 
-- 
1.9.1


  parent reply	other threads:[~2020-03-09  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09  8:18 [PATCH 0/3] Some optimization for SC27XX poweroff driver Baolin Wang
2020-03-09  8:18 ` [PATCH 1/3] power: reset: sc27xx: Power off the external subsystems' connection Baolin Wang
2020-03-09  8:18 ` Baolin Wang [this message]
2020-03-09  8:18 ` [PATCH 3/3] power: reset: sc27xx: Allow the SC27XX poweroff driver building into a module Baolin Wang
2020-03-11 22:34 ` [PATCH 0/3] Some optimization for SC27XX poweroff driver Sebastian Reichel

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=fadd883957d4283d3149f00ade8e7a7d3fc912b6.1583740881.git.baolin.wang7@gmail.com \
    --to=baolin.wang7@gmail.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=sre@kernel.org \
    --cc=zhang.lyra@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).