aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/freezer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r--include/linux/freezer.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 4631086f5060..c8e02de737f6 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -1,5 +1,8 @@
1/* Freezer declarations */ 1/* Freezer declarations */
2 2
3#ifndef FREEZER_H_INCLUDED
4#define FREEZER_H_INCLUDED
5
3#include <linux/sched.h> 6#include <linux/sched.h>
4 7
5#ifdef CONFIG_PM 8#ifdef CONFIG_PM
@@ -22,7 +25,7 @@ static inline int freezing(struct task_struct *p)
22/* 25/*
23 * Request that a process be frozen 26 * Request that a process be frozen
24 */ 27 */
25static inline void freeze(struct task_struct *p) 28static inline void set_freeze_flag(struct task_struct *p)
26{ 29{
27 set_tsk_thread_flag(p, TIF_FREEZE); 30 set_tsk_thread_flag(p, TIF_FREEZE);
28} 31}
@@ -30,7 +33,7 @@ static inline void freeze(struct task_struct *p)
30/* 33/*
31 * Sometimes we may need to cancel the previous 'freeze' request 34 * Sometimes we may need to cancel the previous 'freeze' request
32 */ 35 */
33static inline void do_not_freeze(struct task_struct *p) 36static inline void clear_freeze_flag(struct task_struct *p)
34{ 37{
35 clear_tsk_thread_flag(p, TIF_FREEZE); 38 clear_tsk_thread_flag(p, TIF_FREEZE);
36} 39}
@@ -53,7 +56,7 @@ static inline int thaw_process(struct task_struct *p)
53 wake_up_process(p); 56 wake_up_process(p);
54 return 1; 57 return 1;
55 } 58 }
56 clear_tsk_thread_flag(p, TIF_FREEZE); 59 clear_freeze_flag(p);
57 task_unlock(p); 60 task_unlock(p);
58 return 0; 61 return 0;
59} 62}
@@ -115,10 +118,19 @@ static inline int freezer_should_skip(struct task_struct *p)
115 return !!(p->flags & PF_FREEZER_SKIP); 118 return !!(p->flags & PF_FREEZER_SKIP);
116} 119}
117 120
121/*
122 * Tell the freezer that the current task should be frozen by it
123 */
124static inline void set_freezable(void)
125{
126 current->flags &= ~PF_NOFREEZE;
127}
128
118#else 129#else
119static inline int frozen(struct task_struct *p) { return 0; } 130static inline int frozen(struct task_struct *p) { return 0; }
120static inline int freezing(struct task_struct *p) { return 0; } 131static inline int freezing(struct task_struct *p) { return 0; }
121static inline void freeze(struct task_struct *p) { BUG(); } 132static inline void set_freeze_flag(struct task_struct *p) {}
133static inline void clear_freeze_flag(struct task_struct *p) {}
122static inline int thaw_process(struct task_struct *p) { return 1; } 134static inline int thaw_process(struct task_struct *p) { return 1; }
123 135
124static inline void refrigerator(void) {} 136static inline void refrigerator(void) {}
@@ -130,4 +142,7 @@ static inline int try_to_freeze(void) { return 0; }
130static inline void freezer_do_not_count(void) {} 142static inline void freezer_do_not_count(void) {}
131static inline void freezer_count(void) {} 143static inline void freezer_count(void) {}
132static inline int freezer_should_skip(struct task_struct *p) { return 0; } 144static inline int freezer_should_skip(struct task_struct *p) { return 0; }
145static inline void set_freezable(void) {}
133#endif 146#endif
147
148#endif /* FREEZER_H_INCLUDED */