[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221127-snd-freeze-v3-1-a2eda731ca14@chromium.org>
Date: Mon, 28 Nov 2022 10:10:13 +0100
From: Ricardo Ribalda <ribalda@...omium.org>
To: Takashi Iwai <tiwai@...e.com>, Len Brown <len.brown@...el.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Pavel Machek <pavel@....cz>,
"Rafael J. Wysocki" <rafael@...nel.org>
Cc: alsa-devel@...a-project.org,
"Joel Fernandes (Google)" <joel@...lfernandes.org>,
Ricardo Ribalda <ribalda@...omium.org>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: [PATCH v3 1/2] freezer: Add processes_frozen()
Add a way to let the drivers know if the processes are frozen.
This is needed by drivers that are waiting for processes to end on their
shutdown path.
Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
---
include/linux/freezer.h | 2 ++
kernel/freezer.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index b303472255be..ca861ace0689 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -47,6 +47,7 @@ extern int freeze_processes(void);
extern int freeze_kernel_threads(void);
extern void thaw_processes(void);
extern void thaw_kernel_threads(void);
+bool processes_frozen(void);
static inline bool try_to_freeze(void)
{
@@ -80,6 +81,7 @@ static inline int freeze_processes(void) { return -ENOSYS; }
static inline int freeze_kernel_threads(void) { return -ENOSYS; }
static inline void thaw_processes(void) {}
static inline void thaw_kernel_threads(void) {}
+static inline bool processes_frozen(void) { return false; }
static inline bool try_to_freeze(void) { return false; }
diff --git a/kernel/freezer.c b/kernel/freezer.c
index 4fad0e6fca64..08828c4e12fd 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -233,3 +233,14 @@ bool set_freezable(void)
return try_to_freeze();
}
EXPORT_SYMBOL(set_freezable);
+
+/**
+ * processes_frozen - Check if the processes are frozen
+ *
+ * Let drivers know if they shall wait for processes.
+ */
+bool processes_frozen(void)
+{
+ return pm_freezing;
+}
+EXPORT_SYMBOL(processes_frozen);
--
2.38.1.584.g0f3c55d4c2-goog-b4-0.11.0-dev-696ae
Powered by blists - more mailing lists