#include <linux/workqueue.h>
#include <linux/freezer.h>
-
+/**
+ * struct alarm_base - Alarm timer bases
+ * @lock: Lock for syncrhonized access to the base
+ * @timerqueue: Timerqueue head managing the list of events
+ * @timer: hrtimer used to schedule events while running
+ * @gettime: Function to read the time correlating to the base
+ * @base_clockid: clockid for the base
+ * @irqwork Delayed work structure for expiring timers
+ */
static struct alarm_base {
spinlock_t lock;
struct timerqueue_head timerqueue;
struct work_struct irqwork;
} alarm_bases[ALARM_NUMTYPE];
+/* rtc timer and device for setting alarm wakeups at suspend */
static struct rtc_timer rtctimer;
static struct rtc_device *rtcdev;
+/* freezer delta & lock used to handle clock_nanosleep triggered wakeups */
static ktime_t freezer_delta;
static DEFINE_SPINLOCK(freezer_delta_lock);
-/**************************************************************************
- * alarmtimer management code
- */
-
-/*
+/**
* alarmtimer_enqueue - Adds an alarm timer to an alarm_base timerqueue
* @base: pointer to the base where the timer is being run
* @alarm: pointer to alarm being enqueued.
}
}
-/*
+/**
* alarmtimer_remove - Removes an alarm timer from an alarm_base timerqueue
* @base: pointer to the base where the timer is running
* @alarm: pointer to alarm being removed
}
}
-/*
+/**
* alarmtimer_do_work - Handles alarm being fired.
* @work: pointer to workqueue being run
*
- * When a timer fires, this runs through the timerqueue to see
- * which alarm timers, and run those that expired. If there are
- * more alarm timers queued, we set the hrtimer to fire in the
- * future.
+ * When a alarm timer fires, this runs through the timerqueue to
+ * see which alarms expired, and runs those. If there are more alarm
+ * timers queued for the future, we set the hrtimer to fire when
+ * when the next future alarm timer expires.
*/
-void alarmtimer_do_work(struct work_struct *work)
+static void alarmtimer_do_work(struct work_struct *work)
{
struct alarm_base *base = container_of(work, struct alarm_base,
irqwork);
}
-/*
+/**
* alarmtimer_fired - Handles alarm hrtimer being fired.
* @timer: pointer to hrtimer being run
*
}
-/*
+/**
* alarmtimer_suspend - Suspend time callback
* @dev: unused
* @state: unused
}
-/**************************************************************************
- * alarm kernel interface code
- */
-
-/*
+/**
* alarm_init - Initialize an alarm structure
* @alarm: ptr to alarm to be initialized
* @type: the type of the alarm
* @function: callback that is run when the alarm fires
- *
- * In-kernel interface to initializes the alarm structure.
*/
void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
void (*function)(struct alarm *))
alarm->enabled = 0;
}
-/*
+/**
* alarm_start - Sets an alarm to fire
* @alarm: ptr to alarm to set
* @start: time to run the alarm
* @period: period at which the alarm will recur
- *
- * In-kernel interface set an alarm timer.
*/
void alarm_start(struct alarm *alarm, ktime_t start, ktime_t period)
{
spin_unlock_irqrestore(&base->lock, flags);
}
-/*
+/**
* alarm_cancel - Tries to cancel an alarm timer
* @alarm: ptr to alarm to be canceled
- *
- * In-kernel interface to cancel an alarm timer.
*/
void alarm_cancel(struct alarm *alarm)
{
}
-/**************************************************************************
- * alarm posix interface code
- */
-
-/*
+/**
* clock2alarm - helper that converts from clockid to alarmtypes
* @clockid: clockid.
- *
- * Helper function that converts from clockids to alarmtypes
*/
static enum alarmtimer_type clock2alarm(clockid_t clockid)
{
return -1;
}
-/*
+/**
* alarm_handle_timer - Callback for posix timers
* @alarm: alarm that fired
*
ptr->it_overrun++;
}
-/*
+/**
* alarm_clock_getres - posix getres interface
* @which_clock: clockid
* @tp: timespec to fill
return ret;
}
-/**************************************************************************
- * alarmtimer initialization code
- */
/* Suspend hook structures */
static const struct dev_pm_ops alarmtimer_pm_ops = {