Commit 97715e29 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Kalle Valo

wifi: 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: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxs-00E8vc-DD@rmk-PC.armlinux.org.uk
parent b734d883
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment