Lines Matching refs:hrtimer
37 #include <linux/hrtimer.h>
42 struct hrtimer *hrtimer;
45 hrtimer = arg;
46 ret = hrtimer->function(hrtimer);
49 callout_schedule_sbt(&hrtimer->callout,
50 nstosbt(hrtimer->expires), nstosbt(hrtimer->precision), 0);
52 callout_deactivate(&hrtimer->callout);
57 linux_hrtimer_active(struct hrtimer *hrtimer)
61 mtx_lock(&hrtimer->mtx);
62 ret = callout_active(&hrtimer->callout);
63 mtx_unlock(&hrtimer->mtx);
69 * Cancel active hrtimer.
73 linux_hrtimer_cancel(struct hrtimer *hrtimer)
76 return (callout_drain(&hrtimer->callout) > 0);
80 linux_hrtimer_init(struct hrtimer *hrtimer)
83 memset(hrtimer, 0, sizeof(*hrtimer));
84 mtx_init(&hrtimer->mtx, "hrtimer", NULL,
86 callout_init_mtx(&hrtimer->callout, &hrtimer->mtx, 0);
90 linux_hrtimer_set_expires(struct hrtimer *hrtimer, ktime_t time)
92 hrtimer->expires = ktime_to_ns(time);
96 linux_hrtimer_start(struct hrtimer *hrtimer, ktime_t time)
99 linux_hrtimer_start_range_ns(hrtimer, time, 0);
103 linux_hrtimer_start_range_ns(struct hrtimer *hrtimer, ktime_t time,
107 mtx_lock(&hrtimer->mtx);
108 hrtimer->precision = nsec;
109 callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(time)),
110 nstosbt(nsec), hrtimer_call_handler, hrtimer, 0);
111 mtx_unlock(&hrtimer->mtx);
115 linux_hrtimer_forward_now(struct hrtimer *hrtimer, ktime_t interval)
118 mtx_lock(&hrtimer->mtx);
119 callout_reset_sbt(&hrtimer->callout, nstosbt(ktime_to_ns(interval)),
120 nstosbt(hrtimer->precision), hrtimer_call_handler, hrtimer, 0);
121 mtx_unlock(&hrtimer->mtx);