From patchwork Thu Dec 23 01:14:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Mosberger-Tang X-Patchwork-Id: 527671 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9F6CC433F5 for ; Thu, 23 Dec 2021 01:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346786AbhLWBQT (ORCPT ); Wed, 22 Dec 2021 20:16:19 -0500 Received: from o1.ptr2625.egauge.net ([167.89.112.53]:27352 "EHLO o1.ptr2625.egauge.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346240AbhLWBOp (ORCPT ); Wed, 22 Dec 2021 20:14:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=egauge.net; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=sgd; bh=3Uz4xO2jk3PwsoBap/NCYCWsUTTJtakQF5q2JJp4lHQ=; b=AZzNDwI6isj4Br0GlK+kU9dM02F55UA7gnqhdWD4g8J9QC8JK5gEL8nqvU30FKtTH49i NSw1KGcWfQOGA6WrxwehnMkuTcELkuhfmyefoefLBvWE8H8C9g3zI6qunfFcje3ESFh+is 0nX4c6szL6ltEyjbImHFOT7Uoi7/3YZ7D5Wz3p5PJVqUCheDVgkPrEd9SwH7QjuryPS1pn SQM/GiZHMfnD0rqlnpcHOtg3IqPsbkbUSP7KTY4rm6honUjP9v0kMWvSgrqc/29aIsCmui ICFxsO7sEc2wao74pm2osw1hddjyx5g+Mb2B5P4Ui4DRYXJ1TdE0/ij+1QXT/JgQ== Received: by filterdrecv-656998cfdd-ngmx2 with SMTP id filterdrecv-656998cfdd-ngmx2-1-61C3CD5E-3B 2021-12-23 01:14:07.038024374 +0000 UTC m=+7955207.334259020 Received: from pearl.egauge.net (unknown) by geopod-ismtpd-6-0 (SG) with ESMTP id qOYqVE5dTvSY-kPoDwTdQg Thu, 23 Dec 2021 01:14:06.874 +0000 (UTC) Received: by pearl.egauge.net (Postfix, from userid 1000) id C5063701508; Wed, 22 Dec 2021 18:14:05 -0700 (MST) From: David Mosberger-Tang Subject: [PATCH v2 41/50] wilc1000: use more descriptive variable name Date: Thu, 23 Dec 2021 01:14:07 +0000 (UTC) Message-Id: <20211223011358.4031459-42-davidm@egauge.net> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211223011358.4031459-1-davidm@egauge.net> References: <20211223011358.4031459-1-davidm@egauge.net> MIME-Version: 1.0 X-SG-EID: +kMxBqj35EdRUKoy8diX1j4AXmPtd302oan+iXZuF8m2Nw4HRW2irNspffT/khET6RJF6+Prbl0h/EtF1rRLvPuMcF/BHm6zz5zzmpsOhjqu7S67FdJWIs8jvoN5AmbDIi6dQ8lNtN54xxhDmyuQ276OPAzpKlpaoXNFiJAEfxr9wPtcrvfGZixzr32KlEK7Bse2M3yDlPofPOXCtgL4a5I2o7o0OFuq4T9T05KfXjLYZYc903u9NP0HGpJpzXh5DqXVIUN9B0p5YrBimE/XDw== To: Ajay Singh Cc: Claudiu Beznea , Kalle Valo , "David S. Miller" , Jakub Kicinski , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David Mosberger-Tang X-Entity-ID: Xg4JGAcGrJFIz2kDG9eoaQ== Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Now that the factoring is done, again rename "i" to "vmm_table_len" to improve readability. Signed-off-by: David Mosberger-Tang --- .../net/wireless/microchip/wilc1000/wlan.c | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c index f01f7bade6189..f89ea4839aa61 100644 --- a/drivers/net/wireless/microchip/wilc1000/wlan.c +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -681,7 +681,7 @@ static void set_header(struct wilc *wilc, struct sk_buff *tqe, * WILC_VMM_TBL_SIZE packets or up to WILC_TX_BUFF_SIZE bytes. */ static int schedule_packets(struct wilc *wilc, - int i, u32 vmm_table[WILC_VMM_TBL_SIZE]) + int vmm_table_len, u32 vmm_table[WILC_VMM_TBL_SIZE]) { u8 k, ac; static const u8 ac_preserve_ratio[NQUEUES] = {1, 1, 1, 1}; @@ -702,8 +702,8 @@ static int schedule_packets(struct wilc *wilc, ac_exist = 1; for (k = 0; k < num_pkts_to_add[ac]; k++) { - if (i >= WILC_VMM_TBL_SIZE - 1) - return i; + if (vmm_table_len >= WILC_VMM_TBL_SIZE - 1) + return vmm_table_len; tqe = skb_dequeue(&wilc->txq[ac]); if (!tqe) @@ -717,21 +717,21 @@ static int schedule_packets(struct wilc *wilc, if (wilc->chipq_bytes + vmm_sz > WILC_TX_BUFF_SIZE) { /* return packet to its queue */ skb_queue_head(&wilc->txq[ac], tqe); - return i; + return vmm_table_len; } atomic_dec(&wilc->txq_entries); __skb_queue_tail(&wilc->chipq, tqe); wilc->chipq_bytes += tqe->len; - vmm_table[i] = vmm_table_entry(tqe, vmm_sz); - i++; + vmm_table[vmm_table_len] = vmm_table_entry(tqe, vmm_sz); + vmm_table_len++; } } num_pkts_to_add = ac_preserve_ratio; } while (ac_exist); - return i; + return vmm_table_len; } /** @@ -747,13 +747,10 @@ static int schedule_packets(struct wilc *wilc, */ static int fill_vmm_table(struct wilc *wilc, u32 vmm_table[WILC_VMM_TBL_SIZE]) { - int i; - int vmm_sz = 0; + int vmm_table_len = 0, vmm_sz = 0; struct sk_buff *tqe; struct wilc_skb_tx_cb *tx_cb; - i = 0; - if (unlikely(wilc->chipq_bytes > 0)) { /* fill in packets that are already on the chipq: */ skb_queue_walk(&wilc->chipq, tqe) { @@ -761,16 +758,16 @@ static int fill_vmm_table(struct wilc *wilc, u32 vmm_table[WILC_VMM_TBL_SIZE]) vmm_sz = tx_hdr_len(tx_cb->type); vmm_sz += tqe->len; vmm_sz = ALIGN(vmm_sz, 4); - vmm_table[i++] = vmm_table_entry(tqe, vmm_sz); + vmm_table[vmm_table_len++] = vmm_table_entry(tqe, vmm_sz); } } - i = schedule_packets(wilc, i, vmm_table); - if (i > 0) { - WARN_ON(i >= WILC_VMM_TBL_SIZE); - vmm_table[i] = 0x0; + vmm_table_len = schedule_packets(wilc, vmm_table_len, vmm_table); + if (vmm_table_len > 0) { + WARN_ON(vmm_table_len >= WILC_VMM_TBL_SIZE); + vmm_table[vmm_table_len] = 0x0; } - return i; + return vmm_table_len; } /**