ACPI: bay: fix build warning
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / freezer.h
blob5e75e26d4787248caf175063afad75010824672a
1 /* Freezer declarations */
3 #include <linux/sched.h>
5 #ifdef CONFIG_PM
6 /*
7 * Check if a process has been frozen
8 */
9 static inline int frozen(struct task_struct *p)
11 return p->flags & PF_FROZEN;
15 * Check if there is a request to freeze a process
17 static inline int freezing(struct task_struct *p)
19 return test_tsk_thread_flag(p, TIF_FREEZE);
23 * Request that a process be frozen
25 static inline void freeze(struct task_struct *p)
27 set_tsk_thread_flag(p, TIF_FREEZE);
31 * Sometimes we may need to cancel the previous 'freeze' request
33 static inline void do_not_freeze(struct task_struct *p)
35 clear_tsk_thread_flag(p, TIF_FREEZE);
39 * Wake up a frozen process
41 static inline int thaw_process(struct task_struct *p)
43 if (frozen(p)) {
44 p->flags &= ~PF_FROZEN;
45 wake_up_process(p);
46 return 1;
48 return 0;
52 * freezing is complete, mark process as frozen
54 static inline void frozen_process(struct task_struct *p)
56 p->flags |= PF_FROZEN;
57 wmb();
58 clear_tsk_thread_flag(p, TIF_FREEZE);
61 extern void refrigerator(void);
62 extern int freeze_processes(void);
63 extern void thaw_processes(void);
65 static inline int try_to_freeze(void)
67 if (freezing(current)) {
68 refrigerator();
69 return 1;
70 } else
71 return 0;
74 extern void thaw_some_processes(int all);
76 #else
77 static inline int frozen(struct task_struct *p) { return 0; }
78 static inline int freezing(struct task_struct *p) { return 0; }
79 static inline void freeze(struct task_struct *p) { BUG(); }
80 static inline int thaw_process(struct task_struct *p) { return 1; }
81 static inline void frozen_process(struct task_struct *p) { BUG(); }
83 static inline void refrigerator(void) {}
84 static inline int freeze_processes(void) { BUG(); return 0; }
85 static inline void thaw_processes(void) {}
87 static inline int try_to_freeze(void) { return 0; }
90 #endif