Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c8cd6b6 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Rafael J. Wysocki
Browse files

PM / s2idle: Make s2idle_wait_head swait based



s2idle_wait_head is used during s2idle with interrupts disabled even on
RT. There is no "custom" wake up function so swait could be used instead
which is also lower weight compared to the wait_queue.
Make s2idle_wait_head a swait_queue_head.

Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent bccaadab
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@
#include <linux/export.h>
#include <linux/export.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/syscore_ops.h>
#include <linux/swait.h>
#include <linux/ftrace.h>
#include <linux/ftrace.h>
#include <trace/events/power.h>
#include <trace/events/power.h>
#include <linux/compiler.h>
#include <linux/compiler.h>
@@ -57,7 +58,7 @@ EXPORT_SYMBOL_GPL(pm_suspend_global_flags);


static const struct platform_suspend_ops *suspend_ops;
static const struct platform_suspend_ops *suspend_ops;
static const struct platform_s2idle_ops *s2idle_ops;
static const struct platform_s2idle_ops *s2idle_ops;
static DECLARE_WAIT_QUEUE_HEAD(s2idle_wait_head);
static DECLARE_SWAIT_QUEUE_HEAD(s2idle_wait_head);


enum s2idle_states __read_mostly s2idle_state;
enum s2idle_states __read_mostly s2idle_state;
static DEFINE_SPINLOCK(s2idle_lock);
static DEFINE_SPINLOCK(s2idle_lock);
@@ -91,7 +92,7 @@ static void s2idle_enter(void)
	/* Push all the CPUs into the idle loop. */
	/* Push all the CPUs into the idle loop. */
	wake_up_all_idle_cpus();
	wake_up_all_idle_cpus();
	/* Make the current CPU wait so it can enter the idle loop too. */
	/* Make the current CPU wait so it can enter the idle loop too. */
	wait_event(s2idle_wait_head,
	swait_event(s2idle_wait_head,
		    s2idle_state == S2IDLE_STATE_WAKE);
		    s2idle_state == S2IDLE_STATE_WAKE);


	cpuidle_pause();
	cpuidle_pause();
@@ -159,7 +160,7 @@ void s2idle_wake(void)
	spin_lock_irqsave(&s2idle_lock, flags);
	spin_lock_irqsave(&s2idle_lock, flags);
	if (s2idle_state > S2IDLE_STATE_NONE) {
	if (s2idle_state > S2IDLE_STATE_NONE) {
		s2idle_state = S2IDLE_STATE_WAKE;
		s2idle_state = S2IDLE_STATE_WAKE;
		wake_up(&s2idle_wait_head);
		swake_up(&s2idle_wait_head);
	}
	}
	spin_unlock_irqrestore(&s2idle_lock, flags);
	spin_unlock_irqrestore(&s2idle_lock, flags);
}
}