[v3,1/2] freezer: Add processes_frozen()
Commit Message
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@chromium.org>
---
include/linux/freezer.h | 2 ++
kernel/freezer.c | 11 +++++++++++
2 files changed, 13 insertions(+)
@@ -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; }
@@ -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);