From patchwork Mon Jul 22 16:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 813730 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp1941200wro; Mon, 22 Jul 2024 09:09:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWlI6+7tFxfFNbo28K/lmAAxjJOy5x3+IAKT6sNspmIq8MXsbqO+TStz0sPiFX7YfT9R194t2+NiTqKsjwe36wU X-Google-Smtp-Source: AGHT+IFcP8rnO/gFlP5z9nMbtwPLNDi1KmgT6VeMaYjbHYNFurHl45thv0xBiOsNJTvvPBkngVM+ X-Received: by 2002:a05:6122:4104:b0:4ed:26:790a with SMTP id 71dfb90a1353d-4f50667e598mr8187265e0c.4.1721664543744; Mon, 22 Jul 2024 09:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721664543; cv=none; d=google.com; s=arc-20160816; b=eem1LsKugLLOma9Ocwse6XFIraslERlXlwp517IyjIGA/mrDE/DFCy4PlYuenXSc82 fF98yByIVRnuTJRezeHKdvs0dSP0VEjq+QJWu4BC9DeIgfCPmjFKoG8bfAaX8Etdg9Kc Se9JTHqhzUsN8nFzOahtET6BhNpVTHGa2dgYMBxRMAw4lnvg6D3DHwVARpkcC3VJc09B E3oWP//mAIhSfMKFvGCxHYLyNZKfR/1L3YVvSWXm9thtk6KcTwG1SkB+L4EFml/6ggLy 6r1ayMf0PReKI/tFvjICVe9SbztqNHzEV0TMsMf6bSWB12hzWac4jOqC5gELoxXv9gEO qH4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dS9AnThSzSBrSy+tonVpTP7pqJETnOM97XqDCYC+F+8=; fh=pA26/TpFHAj3dhwie1wJOLhR+LuI9XikNoV1W9RAiFw=; b=b7Sy5Pm5hIm0/1C4lUIOlcfhaXTsE+AcXFadYdkeKC7oF6B6el4OVICXu6SMj/fdi6 Mp1mk3D1BSHQ8sNC36PAQwWVNUD7SIh6QdzkTJsiM7f+21Zt3QbZHf5xptyjQRv9lFzn wB5oHL22C9LwmvijFJL+jucQLTzqbSbpGmNoAyWrDHo6A6I6npnmVa6VBbLjmbKhFEsI byxOJOUzAwwnrBuAMP3WoGbIQJu42ETuPZTydWnuLXvQLq4BrUNDlvIchn48MBNrvk/k h7sJukmf5YUB+l80rxG/7Zm91LdPr8zRl3MF4+xxN+up6o7O1tHTNqXzexNz13oY9dn6 6xoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d+aJKlWV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-4f5171562c6si613134e0c.204.2024.07.22.09.09.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jul 2024 09:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d+aJKlWV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVvaH-0006cX-AB; Mon, 22 Jul 2024 12:08:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVvaE-0006RF-ED for qemu-devel@nongnu.org; Mon, 22 Jul 2024 12:08:18 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sVva4-0007iF-RD for qemu-devel@nongnu.org; Mon, 22 Jul 2024 12:08:16 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42797bcfc77so33679895e9.2 for ; Mon, 22 Jul 2024 09:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721664486; x=1722269286; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dS9AnThSzSBrSy+tonVpTP7pqJETnOM97XqDCYC+F+8=; b=d+aJKlWVVfxjDQ5KwyJPd2PqXzzi9o68EsqdlYlFnYcC/vR9M6V11ZWj0XEBODaWYB Wyy3dZW2C4k2Dc9grwxBQqIlu2w4glu5oBn1YwwyuLxM+e6zQQ9UmEbUFq8XakAwXQd6 LWWG018vaeFuuWJk/deOfkv/rz4eJp+ddJu99yG4PT386bq9W9hYSzfSK1aDIhlXMF06 dLyLgIjk8IZqA6/Nsq6/wtlP/kYF3AVz337DpARbXhxih4lItk+DGEqNCt9r3ourLFSr gmM4YfZ3yHIKlJWsTt+k72Zqu+2LIm3VXbfGK5bOyuRQHGlrj8msbPmChAkTB6cBeEFK +byA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721664486; x=1722269286; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dS9AnThSzSBrSy+tonVpTP7pqJETnOM97XqDCYC+F+8=; b=VztEMmNgUpI0hJqBhorOt9jZhSi8TnhFncTfDdCpW8L2TGdhreP7gY1N6e1XaiR3e0 I+Zaxx0uGnbbILZ43oh9md3Ld9W+PNuf6WIaPkiaXDkqwUKqnrp0deudF6BAVwHVvzoc kOj0sFRWLzLQlU29XbZ0fwhPRfwPps2KJc9rPEApfc4YF3xiVL9D+ODLj9WxKlVEU7jD s++kCd5YN2hcNd4oQWiWRbv3S6DSiuWlf18HWwfdJSvlvTYUDlhfUpxNlCaLEuHtl4Zw YgP2P/LyTUCF69pM282h6qYKUYGqQtzrCsESSGECdCkCHwD4BG6dnh58i0/+1qUTRrk3 QkMA== X-Gm-Message-State: AOJu0YzEfNG2c8r8rkXBAllwR1kR7l3YDJgNfA3rgJ867buIBxUChtWW pUK2TI+MHYn0IDdsFsKzsyVfHSKTLol+QLTKFb9MFDcMz4WOdUCrYED4Hg81CHE0GaEOxz8PLlq T X-Received: by 2002:a05:600c:45d3:b0:425:649b:60e8 with SMTP id 5b1f17b1804b1-427df7b6d07mr45973825e9.18.1721664485987; Mon, 22 Jul 2024 09:08:05 -0700 (PDT) Received: from localhost.localdomain (gen92-h02-176-184-20-254.dsl.sta.abo.bbox.fr. [176.184.20.254]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e2a1sm159685935e9.31.2024.07.22.09.08.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 22 Jul 2024 09:08:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Maydell , qemu-arm@nongnu.org, =?utf-8?q?Ph?= =?utf-8?q?ilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 3/7] util/fifo8: Use fifo8_reset() in fifo8_create() Date: Mon, 22 Jul 2024 18:07:41 +0200 Message-ID: <20240722160745.67904-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240722160745.67904-1-philmd@linaro.org> References: <20240722160745.67904-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 Avoid open-coding fifo8_reset() in fifo8_create(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland Reviewed-by: Pierrick Bouvier --- util/fifo8.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/util/fifo8.c b/util/fifo8.c index 4e01b532d9..2925fe5611 100644 --- a/util/fifo8.c +++ b/util/fifo8.c @@ -16,12 +16,17 @@ #include "migration/vmstate.h" #include "qemu/fifo8.h" +void fifo8_reset(Fifo8 *fifo) +{ + fifo->num = 0; + fifo->head = 0; +} + void fifo8_create(Fifo8 *fifo, uint32_t capacity) { fifo->data = g_new(uint8_t, capacity); fifo->capacity = capacity; - fifo->head = 0; - fifo->num = 0; + fifo8_reset(fifo); } void fifo8_destroy(Fifo8 *fifo) @@ -97,12 +102,6 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr) return fifo8_peekpop_buf(fifo, max, numptr, true); } -void fifo8_reset(Fifo8 *fifo) -{ - fifo->num = 0; - fifo->head = 0; -} - bool fifo8_is_empty(Fifo8 *fifo) { return (fifo->num == 0);