diff options
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r-- | include/linux/freezer.h | 23 |
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 | */ |
25 | static inline void freeze(struct task_struct *p) | 28 | static 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 | */ |
33 | static inline void do_not_freeze(struct task_struct *p) | 36 | static 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 | */ | ||
124 | static inline void set_freezable(void) | ||
125 | { | ||
126 | current->flags &= ~PF_NOFREEZE; | ||
127 | } | ||
128 | |||
118 | #else | 129 | #else |
119 | static inline int frozen(struct task_struct *p) { return 0; } | 130 | static inline int frozen(struct task_struct *p) { return 0; } |
120 | static inline int freezing(struct task_struct *p) { return 0; } | 131 | static inline int freezing(struct task_struct *p) { return 0; } |
121 | static inline void freeze(struct task_struct *p) { BUG(); } | 132 | static inline void set_freeze_flag(struct task_struct *p) {} |
133 | static inline void clear_freeze_flag(struct task_struct *p) {} | ||
122 | static inline int thaw_process(struct task_struct *p) { return 1; } | 134 | static inline int thaw_process(struct task_struct *p) { return 1; } |
123 | 135 | ||
124 | static inline void refrigerator(void) {} | 136 | static inline void refrigerator(void) {} |
@@ -130,4 +142,7 @@ static inline int try_to_freeze(void) { return 0; } | |||
130 | static inline void freezer_do_not_count(void) {} | 142 | static inline void freezer_do_not_count(void) {} |
131 | static inline void freezer_count(void) {} | 143 | static inline void freezer_count(void) {} |
132 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } | 144 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } |
145 | static inline void set_freezable(void) {} | ||
133 | #endif | 146 | #endif |
147 | |||
148 | #endif /* FREEZER_H_INCLUDED */ | ||