From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA92FC433F5 for ; Mon, 16 May 2022 10:42:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 125B484166; Mon, 16 May 2022 12:42:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Vkt6v+KI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7E03884077; Mon, 16 May 2022 12:41:56 +0200 (CEST) Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CCC1B83F6C for ; Mon, 16 May 2022 12:41:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=3cSqCYgYKBugKcMeVVQYYQVO.MYWe-LYYdVScdc.NOXh.NO@flex--ascull.bounces.google.com Received: by mail-wm1-x34a.google.com with SMTP id m124-20020a1c2682000000b00393fcd2722dso5447274wmm.4 for ; Mon, 16 May 2022 03:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=5OBgcBLjm1IHXUGtTkBvODQpGTkJ4GEqOMeZRTNnVaE=; b=Vkt6v+KIqtBNh0wO/H2gWLxWVlarLQY+dTo3Y9aZg8A/twP26yPnk5Z0iEEgeXNmZ9 WgCibNEO5hhjqtJOdkeqROaURr/NPAfNBT9UubJ0Q6jHW6lLQt0e1vgkM+A2Jk/cqKZm zJs0qkbLzZxX8xfulyCtttEk/Y4/FLSHaFsqRJ/msDnDiijY5DZfejDl2fu0Tr8qZ4un 5c4Gt7tN4t0MIX+asIsUu0smQHrv1BljLHMXDWJ12A/061/GbEoT6ZtX/nw6yLpt12Wo 34w3vZLhh9IvANBwKYlFwu201V9I0OZM0kes5buZmXRbB1v1txEMbG5iasoszpOZwTfV 8rqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=5OBgcBLjm1IHXUGtTkBvODQpGTkJ4GEqOMeZRTNnVaE=; b=xrnOQytewSDAcTL4ia7rMo/pd6nArdKaKFUhndwf9mpkwnBP9QRngGHNUkK9e5tcc1 CoFO83ELETLGabXynWmiXE2ODzEgXrjRK2Jy/CU+21/YaXhdxYfL8mXsgc6+G3p+k1Gy E+AE+UITslUELNzPpmWmDy+j77e6lDiYb4/QqgHlTwq41YifD31ibh7yGwHkNSicvq4W fOMKe0f+Mb/pJwHFNfAYtzlKp/BSR3FpDdUZ0kKgXaqXegLhwKa0J4Op+zruwmRWzimd w1kIf2M2BfqJZCel/H691gzWdjLqQkgc2PJwS4wZSUbgX6ld1m3Jlni0vJF9S4eK96NW VUuQ== X-Gm-Message-State: AOAM530C1uVIz5YEvvw4bE38zkCJNEDMPF0ADjI/RRG6lv7PBvyqMVgT qVcwg2JRkg7sGLbFcLcQSBsySEBhccUbNEbjYlvMXSt5FDzrKneJrCBYc7WTaZGaLVJ8NU4hVbx B6Q6l1Tq8nk3I9o9bF2/4ATlMYz6UPiT8HvIHXoNJofYQXZV6GcTjZAoapOE= X-Google-Smtp-Source: ABdhPJx6KzuoI8RtxlE/7WfllV4HgBJegqf1N8Q4lGpp/+Xc3jhEnqUSA7+58+RPr4c0B0il3enaswDojwE= X-Received: from ascull.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1510]) (user=ascull job=sendgmr) by 2002:a05:600c:a01:b0:395:c416:d82d with SMTP id z1-20020a05600c0a0100b00395c416d82dmr18311903wmp.88.1652697713597; Mon, 16 May 2022 03:41:53 -0700 (PDT) Date: Mon, 16 May 2022 10:41:29 +0000 In-Reply-To: <20220516104140.1047229-1-ascull@google.com> Message-Id: <20220516104140.1047229-2-ascull@google.com> Mime-Version: 1.0 References: <20220516104140.1047229-1-ascull@google.com> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog Subject: [PATCH v3 01/12] virtio_ring: Merge identical variables From: Andrew Scull To: u-boot@lists.denx.de Cc: sjg@chromium.org, trini@konsulko.com, bmeng.cn@gmail.com, Andrew Scull Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The variables `total_sg` and `descs_used` have the same value. Replace the few uses of `total_sg` with `descs_used` to simplify the situation. Signed-off-by: Andrew Scull Reviewed-by: Simon Glass Reviewed-by: Bin Meng --- drivers/virtio/virtio_ring.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 7f1cbc5932..a6922ce1b8 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -20,17 +20,16 @@ int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[], unsigned int out_sgs, unsigned int in_sgs) { struct vring_desc *desc; - unsigned int total_sg = out_sgs + in_sgs; - unsigned int i, n, avail, descs_used, uninitialized_var(prev); + unsigned int descs_used = out_sgs + in_sgs; + unsigned int i, n, avail, uninitialized_var(prev); int head; - WARN_ON(total_sg == 0); + WARN_ON(descs_used == 0); head = vq->free_head; desc = vq->vring.desc; i = head; - descs_used = total_sg; if (vq->num_free < descs_used) { debug("Can't add buf len %i - avail = %i\n", -- 2.36.0.550.gb090851708-goog