From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ablmd-0003wV-PX for qemu-devel@nongnu.org; Fri, 04 Mar 2016 04:12:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ablma-0004fG-IG for qemu-devel@nongnu.org; Fri, 04 Mar 2016 04:12:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ablma-0004ew-Da for qemu-devel@nongnu.org; Fri, 04 Mar 2016 04:12:24 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 174F77F0B4 for ; Fri, 4 Mar 2016 09:12:24 +0000 (UTC) References: <1457010971-24771-1-git-send-email-lprosek@redhat.com> <20160304062723.GH15443@grmbl.mre> From: Paolo Bonzini Message-ID: <56D95173.9050108@redhat.com> Date: Fri, 4 Mar 2016 10:12:19 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] rng: switch request queue to QSIMPLEQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ladi Prosek , Amit Shah Cc: pagupta , qemu-devel@nongnu.org On 04/03/2016 09:04, Ladi Prosek wrote: >>> >> + QSIMPLEQ_INIT(&s->requests); >>> >> } >> > >> > This init here isn't necessary, the accessors for the queue will take >> > care of this. > We are basically purging the queue here and we want to leave it in a > consistent state. Without the QSIMPLEQ_INIT the queue head would > become a pair of dangling pointers. Let me know if I misunderstood > your comment. It wouldn't, check out QSIMPLEQ_REMOVE_HEAD: #define QSIMPLEQ_REMOVE_HEAD(head, field) do { if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) (head)->sqh_last = &(head)->sqh_first; } while (/*CONSTCOND*/0) The queue would become { NULL, &s->requests.sqh_first }. So the QSIMPLEQ_INIT is indeed redundant. Paolo