- if (need_next) {
- if (!timers->level[level+1]) {
- found = find_first(&timers->far, found);
- } else {
- base >>= TIMER_LEVEL_BITS;
- off = base % PER_LEVEL;
- h = &timers->level[level+1]->list[off];
- found = find_first(h, found);
+static const struct timer *get_first(struct timers *timers)
+{
+ /* We can have just far timers, for example. */
+ if (timers->level[0]) {
+ /* First search rest of lower buckets; we've already spilled
+ * so if we find one there we don't need to search further. */
+ unsigned int i, off = timers->base % PER_LEVEL;
+
+ for (i = off; i < PER_LEVEL; i++) {
+ struct list_head *h = &timers->level[0]->list[i];
+ if (!list_empty(h))
+ return find_first(h, 0, NULL);