From patchwork Sat Feb 8 15:58:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 24360 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9FA8A20967 for ; Sat, 8 Feb 2014 16:04:40 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 131sf5776257ykp.1 for ; Sat, 08 Feb 2014 08:04:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=l4Mian2QR7EqK0/0IWRctB1b9OpwRjOAet4JEzKiG3E=; b=VBoP88zdqtCulLm0U//K83fpAhNYNHB8SrYJyptiG26LJNhGZCKW1YaRuvdXlDz1kT WYs8LEtbCIt2wn5Pwz5NqvZTSQpqqYcGLNSWaYjnul4qbm1DWkEf0zwxEpNSdNH17ljK EE9IUS9AKItedh2cXWfKsNd0knQexn2X/aX5yYgl+UKKuGaS43YCiyIdpTW2PmBhSXEZ aBInvBy1UOT5fsTN6ZL77y5OfM5eusSLxWBWIBiyEUw/mCyXwdNWp8Pqz3RJgmZTWDBb 9Eo/lZU/2uqyNau46knckmVkGe3I5YmKjiZQO/H+Q1eE2nHdgyWIh6XxujkbiG4w7XGf zPxw== X-Gm-Message-State: ALoCoQnMltDxFfT0IdThF/5cEEFRvkI86dGLtgipLhmxa7iMTCtkEdFJ/y4Q+mrimzpjEX45n0WN X-Received: by 10.52.236.231 with SMTP id ux7mr7238672vdc.7.1391875479772; Sat, 08 Feb 2014 08:04:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.52 with SMTP id j49ls1468232qge.7.gmail; Sat, 08 Feb 2014 08:04:39 -0800 (PST) X-Received: by 10.220.53.66 with SMTP id l2mr195084vcg.33.1391875479695; Sat, 08 Feb 2014 08:04:39 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id sx1si1509436vdc.36.2014.02.08.08.04.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Feb 2014 08:04:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so3703614veb.2 for ; Sat, 08 Feb 2014 08:04:39 -0800 (PST) X-Received: by 10.220.99.72 with SMTP id t8mr15469529vcn.10.1391875479627; Sat, 08 Feb 2014 08:04:39 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp40584vcz; Sat, 8 Feb 2014 08:04:39 -0800 (PST) X-Received: by 10.224.124.133 with SMTP id u5mr32287681qar.79.1391875478850; Sat, 08 Feb 2014 08:04:38 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 8si6163840qak.34.2014.02.08.08.04.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 08 Feb 2014 08:04:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:47044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCAOU-0000Me-9b for patch@linaro.org; Sat, 08 Feb 2014 11:04:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCAIW-0007bR-AN for qemu-devel@nongnu.org; Sat, 08 Feb 2014 10:58:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCAIV-0002x7-Ae for qemu-devel@nongnu.org; Sat, 08 Feb 2014 10:58:28 -0500 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:45684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCAIV-0002tl-4o for qemu-devel@nongnu.org; Sat, 08 Feb 2014 10:58:27 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WCAI9-0003M8-Sh; Sat, 08 Feb 2014 15:58:05 +0000 From: Peter Maydell To: Anthony Liguori Date: Sat, 8 Feb 2014 15:58:01 +0000 Message-Id: <1391875084-12772-27-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391875084-12772-1-git-send-email-peter.maydell@linaro.org> References: <1391875084-12772-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Blue Swirl , qemu-devel@nongnu.org, Aurelien Jarno Subject: [Qemu-devel] [PULL 26/29] util/fifo8: clear fifo head upon reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Beniamino Galvani To improve the predictability of fifo8_pop_buf(), the fifo head is set to the start of data buffer upon a reset so that the first call to the function will be able to retrieve all data in the fifo. Signed-off-by: Beniamino Galvani Reviewed-by: Peter Crosthwaite Signed-off-by: Peter Maydell --- util/fifo8.c | 1 + 1 file changed, 1 insertion(+) diff --git a/util/fifo8.c b/util/fifo8.c index a7503c2..6a43482 100644 --- a/util/fifo8.c +++ b/util/fifo8.c @@ -89,6 +89,7 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num) void fifo8_reset(Fifo8 *fifo) { fifo->num = 0; + fifo->head = 0; } bool fifo8_is_empty(Fifo8 *fifo)