summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-05-11 15:15:14 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-04-15 11:54:03 +0100
commit7081e7645698bdc0e9b02a496f4cc11912a54e7f (patch)
tree45f8fb3105203b4d12cfb99bc6abd9c7328807e6
parentd892cc8041c0ce5cea2a62ae5d9832aa3a1bb269 (diff)
net: wlcore: improve code in wlcore_fw_status()
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) <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 5736acb4d206..106b54c2d429 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;