diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/alarmtimer.h | 40 | ||||
-rw-r--r-- | include/linux/capability.h | 7 | ||||
-rw-r--r-- | include/linux/posix-timers.h | 2 | ||||
-rw-r--r-- | include/linux/rbtree.h | 8 | ||||
-rw-r--r-- | include/linux/time.h | 3 | ||||
-rw-r--r-- | include/linux/timerqueue.h | 2 |
6 files changed, 60 insertions, 2 deletions
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h new file mode 100644 index 000000000000..c5d6095b46f8 --- /dev/null +++ b/include/linux/alarmtimer.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef _LINUX_ALARMTIMER_H | ||
2 | #define _LINUX_ALARMTIMER_H | ||
3 | |||
4 | #include <linux/time.h> | ||
5 | #include <linux/hrtimer.h> | ||
6 | #include <linux/timerqueue.h> | ||
7 | #include <linux/rtc.h> | ||
8 | |||
9 | enum alarmtimer_type { | ||
10 | ALARM_REALTIME, | ||
11 | ALARM_BOOTTIME, | ||
12 | |||
13 | ALARM_NUMTYPE, | ||
14 | }; | ||
15 | |||
16 | /** | ||
17 | * struct alarm - Alarm timer structure | ||
18 | * @node: timerqueue node for adding to the event list this value | ||
19 | * also includes the expiration time. | ||
20 | * @period: Period for recuring alarms | ||
21 | * @function: Function pointer to be executed when the timer fires. | ||
22 | * @type: Alarm type (BOOTTIME/REALTIME) | ||
23 | * @enabled: Flag that represents if the alarm is set to fire or not | ||
24 | * @data: Internal data value. | ||
25 | */ | ||
26 | struct alarm { | ||
27 | struct timerqueue_node node; | ||
28 | ktime_t period; | ||
29 | void (*function)(struct alarm *); | ||
30 | enum alarmtimer_type type; | ||
31 | bool enabled; | ||
32 | void *data; | ||
33 | }; | ||
34 | |||
35 | void alarm_init(struct alarm *alarm, enum alarmtimer_type type, | ||
36 | void (*function)(struct alarm *)); | ||
37 | void alarm_start(struct alarm *alarm, ktime_t start, ktime_t period); | ||
38 | void alarm_cancel(struct alarm *alarm); | ||
39 | |||
40 | #endif | ||
diff --git a/include/linux/capability.h b/include/linux/capability.h index d4675af963fa..4554db0cde86 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
@@ -355,7 +355,12 @@ struct cpu_vfs_cap_data { | |||
355 | 355 | ||
356 | #define CAP_SYSLOG 34 | 356 | #define CAP_SYSLOG 34 |
357 | 357 | ||
358 | #define CAP_LAST_CAP CAP_SYSLOG | 358 | /* Allow triggering something that will wake the system */ |
359 | |||
360 | #define CAP_WAKE_ALARM 35 | ||
361 | |||
362 | |||
363 | #define CAP_LAST_CAP CAP_WAKE_ALARM | ||
359 | 364 | ||
360 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) | 365 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) |
361 | 366 | ||
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index d51243ae0726..808227d40a64 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/timex.h> | 7 | #include <linux/timex.h> |
8 | #include <linux/alarmtimer.h> | ||
8 | 9 | ||
9 | union cpu_time_count { | 10 | union cpu_time_count { |
10 | cputime_t cpu; | 11 | cputime_t cpu; |
@@ -80,6 +81,7 @@ struct k_itimer { | |||
80 | unsigned long incr; | 81 | unsigned long incr; |
81 | unsigned long expires; | 82 | unsigned long expires; |
82 | } mmtimer; | 83 | } mmtimer; |
84 | struct alarm alarmtimer; | ||
83 | } it; | 85 | } it; |
84 | }; | 86 | }; |
85 | 87 | ||
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 7066acb2c530..033b507b33b1 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h | |||
@@ -136,6 +136,14 @@ static inline void rb_set_color(struct rb_node *rb, int color) | |||
136 | #define RB_EMPTY_NODE(node) (rb_parent(node) == node) | 136 | #define RB_EMPTY_NODE(node) (rb_parent(node) == node) |
137 | #define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) | 137 | #define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) |
138 | 138 | ||
139 | static inline void rb_init_node(struct rb_node *rb) | ||
140 | { | ||
141 | rb->rb_parent_color = 0; | ||
142 | rb->rb_right = NULL; | ||
143 | rb->rb_left = NULL; | ||
144 | RB_CLEAR_NODE(rb); | ||
145 | } | ||
146 | |||
139 | extern void rb_insert_color(struct rb_node *, struct rb_root *); | 147 | extern void rb_insert_color(struct rb_node *, struct rb_root *); |
140 | extern void rb_erase(struct rb_node *, struct rb_root *); | 148 | extern void rb_erase(struct rb_node *, struct rb_root *); |
141 | 149 | ||
diff --git a/include/linux/time.h b/include/linux/time.h index 454a26205787..b3061782dec3 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -126,6 +126,7 @@ struct timespec __current_kernel_time(void); /* does not take xtime_lock */ | |||
126 | struct timespec get_monotonic_coarse(void); | 126 | struct timespec get_monotonic_coarse(void); |
127 | void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, | 127 | void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, |
128 | struct timespec *wtom, struct timespec *sleep); | 128 | struct timespec *wtom, struct timespec *sleep); |
129 | void timekeeping_inject_sleeptime(struct timespec *delta); | ||
129 | 130 | ||
130 | #define CURRENT_TIME (current_kernel_time()) | 131 | #define CURRENT_TIME (current_kernel_time()) |
131 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) | 132 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) |
@@ -294,6 +295,8 @@ struct itimerval { | |||
294 | #define CLOCK_REALTIME_COARSE 5 | 295 | #define CLOCK_REALTIME_COARSE 5 |
295 | #define CLOCK_MONOTONIC_COARSE 6 | 296 | #define CLOCK_MONOTONIC_COARSE 6 |
296 | #define CLOCK_BOOTTIME 7 | 297 | #define CLOCK_BOOTTIME 7 |
298 | #define CLOCK_REALTIME_ALARM 8 | ||
299 | #define CLOCK_BOOTTIME_ALARM 9 | ||
297 | 300 | ||
298 | /* | 301 | /* |
299 | * The IDs of various hardware clocks: | 302 | * The IDs of various hardware clocks: |
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h index a520fd70a59f..5088727478fd 100644 --- a/include/linux/timerqueue.h +++ b/include/linux/timerqueue.h | |||
@@ -39,7 +39,7 @@ struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head) | |||
39 | 39 | ||
40 | static inline void timerqueue_init(struct timerqueue_node *node) | 40 | static inline void timerqueue_init(struct timerqueue_node *node) |
41 | { | 41 | { |
42 | RB_CLEAR_NODE(&node->node); | 42 | rb_init_node(&node->node); |
43 | } | 43 | } |
44 | 44 | ||
45 | static inline void timerqueue_init_head(struct timerqueue_head *head) | 45 | static inline void timerqueue_init_head(struct timerqueue_head *head) |