On 2014/11/27 19:04, Gerd Hoffmann wrote: > Hi, > >>> + evt = s->ptr.queue[(s->head+s->n) & QUEUE_MASK]; >> >> s->n is QUEUE_LENGTH, can we directly delete it? >> evt = s->ptr.queue[s->head & QUEUE_MASK] > > I prefer to make clear in the code that we want the last ring element > not the first and leave in the "+n", even if we could take it out. > OK.
Another question, whether or not we handle this scenario before calling hid_set_next_idle(s) ? Maybe it is safer, because hid_idle_timer will call hid_pointer_event(), callback function of hs->event(hs). Thanks, -Gonglei