From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtx44-0001nC-FA for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:16:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xtx3y-0003h2-7M for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:16:48 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:55636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtx3w-0003gU-Om for qemu-devel@nongnu.org; Thu, 27 Nov 2014 06:16:42 -0500 Message-ID: <54770809.1000507@huawei.com> Date: Thu, 27 Nov 2014 19:16:25 +0800 From: Gonglei MIME-Version: 1.0 References: <1417079052-9372-1-git-send-email-kraxel@redhat.com> <5476EE1B.4090302@huawei.com> <1417086243.3722.26.camel@nilsson.home.kraxel.org> In-Reply-To: <1417086243.3722.26.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RfC PATCH] hid: handle full ptr queues in post_load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: "qemu-devel@nongnu.org" , "Dr. David Alan Gilbert" 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