/**
* ktime_get_ts - get the monotonic clock in timespec format
+ *
* @ts: pointer to timespec variable
*
* The function calculates the monotonic clock from the realtime
{
struct hrtimer_base *new_base;
- new_base = &__get_cpu_var(hrtimer_bases)[base->index];
+ new_base = &__get_cpu_var(hrtimer_bases[base->index]);
if (base != new_base) {
/*
# ifndef CONFIG_KTIME_SCALAR
/**
* ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable
+ *
* @kt: addend
* @nsec: the scalar nsec value to add
*
/**
* hrtimer_forward - forward the timer expiry
+ *
* @timer: hrtimer to forward
* @now: forward past this time
* @interval: the interval to forward
if (base->first == &timer->node)
base->first = rb_next(&timer->node);
rb_erase(&timer->node, &base->active);
- rb_set_parent(&timer->node, &timer->node);
+ timer->node.rb_parent = HRTIMER_INACTIVE;
}
/*
/**
* hrtimer_start - (re)start an relative timer on the current CPU
+ *
* @timer: the timer to be added
* @tim: expiry time
* @mode: expiry mode: absolute (HRTIMER_ABS) or relative (HRTIMER_REL)
/**
* hrtimer_try_to_cancel - try to deactivate a timer
+ *
* @timer: hrtimer to stop
*
* Returns:
* 0 when the timer was not active
* 1 when the timer was active
* -1 when the timer is currently excuting the callback function and
- * cannot be stopped
+ * can not be stopped
*/
int hrtimer_try_to_cancel(struct hrtimer *timer)
{
/**
* hrtimer_cancel - cancel a timer and wait for the handler to finish.
+ *
* @timer: the timer to be cancelled
*
* Returns:
/**
* hrtimer_get_remaining - get remaining time for the timer
+ *
* @timer: the timer to read
*/
ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
/**
* hrtimer_init - initialize a timer to the given clock
+ *
* @timer: the timer to be initialized
* @clock_id: the clock to be used
* @mode: timer mode abs/rel
memset(timer, 0, sizeof(struct hrtimer));
- bases = __raw_get_cpu_var(hrtimer_bases);
+ bases = per_cpu(hrtimer_bases, raw_smp_processor_id());
if (clock_id == CLOCK_REALTIME && mode != HRTIMER_ABS)
clock_id = CLOCK_MONOTONIC;
timer->base = &bases[clock_id];
- rb_set_parent(&timer->node, &timer->node);
+ timer->node.rb_parent = HRTIMER_INACTIVE;
}
EXPORT_SYMBOL_GPL(hrtimer_init);
/**
* hrtimer_get_res - get the timer resolution for a clock
+ *
* @which_clock: which clock to query
* @tp: pointer to timespec variable to store the resolution
*
{
struct hrtimer_base *bases;
- bases = __raw_get_cpu_var(hrtimer_bases);
+ bases = per_cpu(hrtimer_bases, raw_smp_processor_id());
*tp = ktime_to_timespec(bases[which_clock].resolution);
return 0;
return HRTIMER_NORESTART;
}
-void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
+void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, task_t *task)
{
sl->timer.function = hrtimer_wakeup;
sl->task = task;
struct hrtimer_base *base = per_cpu(hrtimer_bases, cpu);
int i;
- for (i = 0; i < MAX_HRTIMER_BASES; i++, base++) {
+ for (i = 0; i < MAX_HRTIMER_BASES; i++, base++)
spin_lock_init(&base->lock);
- lockdep_set_class(&base->lock, &base->lock_key);
- }
}
#ifdef CONFIG_HOTPLUG_CPU
}
#endif /* CONFIG_HOTPLUG_CPU */
-static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,
+static int hrtimer_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
long cpu = (long)hcpu;
return NOTIFY_OK;
}
-static struct notifier_block __cpuinitdata hrtimers_nb = {
+static struct notifier_block hrtimers_nb = {
.notifier_call = hrtimer_cpu_notify,
};