From patchwork Tue May 28 09:17:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13676364 X-Patchwork-Delegate: kvalo@adurom.com Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D737617E8F3; Tue, 28 May 2024 09:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716887878; cv=none; b=VpCTTPudTMEHQnrHn6MvkgigBi/kLtlqn28gil/xYmMmrwo1jeEpdG6955HHH0tcZqDoi4UGvpMXnSPcVXsDhXWmbAvfwozAUvNXMtJX1OOzRPpwo4yEwyAFDRfnX2Ovky0w6RmjCmLngU4VA69IPoYNw9gSj1R/gF+cW+G/rS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716887878; c=relaxed/simple; bh=NBVtuUL21VTqpumFWGrktrwmTrAumjJzvLFNX8RXO1M=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=FtxuDTi3N/QhzNiK3+i5k2P3QNgkQ4RDbNwfuOBNvIn9/pbG0yeHQ3cNmIcuk8ftzyUZ8ocv73RHTd5a5kC9GbBce5gy7u8OkCsz3gJkU2kG6lIu4vZYxRWiAe11xhOLLixv0sBE/g66t3Qz+7mBcxE5p0O4whsAG2L0q9wZTWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=J7mujtiV; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="J7mujtiV" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PfGnzg4p0KPeEdVtxHFMLkm7NDRotPoeUjFEFun08h8=; b=J7mujtiVpZoR+55wIVq4Am1X3F 2UNPARm/w4386spkel+5aGZfWeRWVoCZm7fSrgOYiT71oV7mZ5vCKsQ5Ztcy9YwUsuKoWGAtsk5Y9 FrFmRYoRC9mYeO56dTT2pKabd4sZTFsgEhNvKYzz2aAshEE9R2fdDID8BMfXoAk5Xh7TRk10KBMIM KLg/COqYC4BU8XPlEZ1han+VqdQObvYWaXuBOOwJvZtEgdL5LDCJLouecWX7EX5Nl1v2sfem/2ida 5mwNcuxbSlJncL4hb7Y/EVxQ4qD9KUPQV4QJIxBQ1j/DKD5xChshoXpwG+14ncCngyP5tQEMD62Ni JVpKbZGQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:51426 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sBsxp-0004Xq-2K; Tue, 28 May 2024 10:17:49 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sBsxs-00E8vc-DD; Tue, 28 May 2024 10:17:52 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Kalle Valo Cc: Johannes Berg , Michael Nemanov , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH wireless-next 3/8] wifi: wlcore: improve code in wlcore_fw_status() Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 28 May 2024 10:17:52 +0100 Referring to status->counters.tx_lnk_free_pkts[i] multiple times leads to less efficient code. Cache this value in a local variable. This also makes the code clearer. Signed-off-by: Russell King (Oracle) --- drivers/net/wireless/ti/wlcore/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index ef12169f8044..a98b26dc3cb8 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -412,18 +412,18 @@ static int wlcore_fw_status(struct wl1271 *wl, struct wl_fw_status *status) for_each_set_bit(i, wl->links_map, wl->num_links) { - u8 diff; + u8 diff, tx_lnk_free_pkts; lnk = &wl->links[i]; /* prevent wrap-around in freed-packets counter */ - diff = (status->counters.tx_lnk_free_pkts[i] - - lnk->prev_freed_pkts) & 0xff; + tx_lnk_free_pkts = status->counters.tx_lnk_free_pkts[i]; + diff = (tx_lnk_free_pkts - lnk->prev_freed_pkts) & 0xff; if (diff == 0) continue; lnk->allocated_pkts -= diff; - lnk->prev_freed_pkts = status->counters.tx_lnk_free_pkts[i]; + lnk->prev_freed_pkts = tx_lnk_free_pkts; /* accumulate the prev_freed_pkts counter */ lnk->total_freed_pkts += diff;