aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/alarmtimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/alarmtimer.h')
-rw-r--r--include/linux/alarmtimer.h31
1 files changed, 2 insertions, 29 deletions
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 96c5c249b08..9069694e70e 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -21,7 +21,6 @@ enum alarmtimer_restart {
21 21
22#define ALARMTIMER_STATE_INACTIVE 0x00 22#define ALARMTIMER_STATE_INACTIVE 0x00
23#define ALARMTIMER_STATE_ENQUEUED 0x01 23#define ALARMTIMER_STATE_ENQUEUED 0x01
24#define ALARMTIMER_STATE_CALLBACK 0x02
25 24
26/** 25/**
27 * struct alarm - Alarm timer structure 26 * struct alarm - Alarm timer structure
@@ -35,6 +34,7 @@ enum alarmtimer_restart {
35 */ 34 */
36struct alarm { 35struct alarm {
37 struct timerqueue_node node; 36 struct timerqueue_node node;
37 struct hrtimer timer;
38 enum alarmtimer_restart (*function)(struct alarm *, ktime_t now); 38 enum alarmtimer_restart (*function)(struct alarm *, ktime_t now);
39 enum alarmtimer_type type; 39 enum alarmtimer_type type;
40 int state; 40 int state;
@@ -43,39 +43,12 @@ struct alarm {
43 43
44void alarm_init(struct alarm *alarm, enum alarmtimer_type type, 44void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); 45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
46void alarm_start(struct alarm *alarm, ktime_t start); 46int alarm_start(struct alarm *alarm, ktime_t start);
47int alarm_try_to_cancel(struct alarm *alarm); 47int alarm_try_to_cancel(struct alarm *alarm);
48int alarm_cancel(struct alarm *alarm); 48int alarm_cancel(struct alarm *alarm);
49 49
50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); 50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
51 51
52/*
53 * A alarmtimer is active, when it is enqueued into timerqueue or the
54 * callback function is running.
55 */
56static inline int alarmtimer_active(const struct alarm *timer)
57{
58 return timer->state != ALARMTIMER_STATE_INACTIVE;
59}
60
61/*
62 * Helper function to check, whether the timer is on one of the queues
63 */
64static inline int alarmtimer_is_queued(struct alarm *timer)
65{
66 return timer->state & ALARMTIMER_STATE_ENQUEUED;
67}
68
69/*
70 * Helper function to check, whether the timer is running the callback
71 * function
72 */
73static inline int alarmtimer_callback_running(struct alarm *timer)
74{
75 return timer->state & ALARMTIMER_STATE_CALLBACK;
76}
77
78
79/* Provide way to access the rtc device being used by alarmtimers */ 52/* Provide way to access the rtc device being used by alarmtimers */
80struct rtc_device *alarmtimer_get_rtcdev(void); 53struct rtc_device *alarmtimer_get_rtcdev(void);
81 54