Lines Matching refs:co

20 static void insert_callout(struct callout *co)  in insert_callout()  argument
25 if (co->expiry_value < co2->expiry_value) { in insert_callout()
26 TAILQ_INSERT_BEFORE(co2, co, link); in insert_callout()
31 TAILQ_INSERT_TAIL(&callout_head, co, link); in insert_callout()
37 struct callout *co = TAILQ_FIRST(&callout_head); in schedule_next_timeout() local
39 if (co) in schedule_next_timeout()
40 desc->set_next_timeout(desc, co->expiry_value); in schedule_next_timeout()
56 static bool callout_is_active(struct callout *co) in callout_is_active() argument
61 if (co2 == co) in callout_is_active()
67 void callout_rem(struct callout *co) in callout_rem() argument
73 if (callout_is_active(co)) { in callout_rem()
74 TAILQ_REMOVE(&callout_head, co, link); in callout_rem()
81 void callout_add(struct callout *co, bool (*callback)(struct callout *co), in callout_add() argument
89 assert(is_nexus(co) && !callout_is_active(co) && is_unpaged(callback)); in callout_add()
90 *co = (struct callout){ .callback = callback, }; in callout_add()
93 co->period = desc->ms_to_ticks(desc, ms); in callout_add()
94 co->expiry_value = desc->get_now(desc) + co->period; in callout_add()
97 co->period = ms; in callout_add()
100 insert_callout(co); in callout_add()
101 if (desc && co == TAILQ_FIRST(&callout_head)) in callout_add()
107 void callout_set_next_timeout(struct callout *co, uint32_t ms) in callout_set_next_timeout() argument
109 co->period = callout_desc->ms_to_ticks(callout_desc, ms); in callout_set_next_timeout()
115 struct callout *co = NULL; in callout_service_init() local
131 co = TAILQ_FIRST(&tmp_head); in callout_service_init()
132 TAILQ_REMOVE(&tmp_head, co, link); in callout_service_init()
139 co->period = desc->ms_to_ticks(desc, co->period); in callout_service_init()
140 co->expiry_value = now + co->period; in callout_service_init()
141 insert_callout(co); in callout_service_init()
151 struct callout *co = NULL; in callout_service_cb() local
177 co = TAILQ_FIRST(&callout_head); in callout_service_cb()
178 if (co->expiry_value > now) in callout_service_cb()
181 TAILQ_REMOVE(&callout_head, co, link); in callout_service_cb()
183 if (co->callback(co)) { in callout_service_cb()
184 co->expiry_value += co->period; in callout_service_cb()
185 insert_callout(co); in callout_service_cb()