Skip to contentSkip to conversation

net: wireless: marvell: use time_is_before_jiffies() instead of open coding it

PATCH In review Qing Wang 2 participants 2 messages Feb 28, 2022 – Mar 10, 2022

Subsystems (4)
lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 net: wireless: marvell: use time_is_before_jiffies() instead of open coding it

From: Wang Qing <[email protected]>

Use the helper function time_is_{before,after}_jiffies() to improve code readability.

---
 drivers/net/wireless/marvell/mwifiex/tdls.c | 4 ++--
 drivers/net/wireless/marvell/mwl8k.c        | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/tdls.c +2 -2
index 97bb87c..aa77fc3
@@ -1436,8 +1436,8 @@ void mwifiex_check_auto_tdls(struct timer_list *t)
 
 	spin_lock_bh(&priv->auto_tdls_lock);
 	list_for_each_entry(tdls_peer, &priv->auto_tdls_list, list) {
-		if ((jiffies - tdls_peer->rssi_jiffies) >
-		    (MWIFIEX_AUTO_TDLS_IDLE_TIME * HZ)) {
+		if (time_is_before_jiffies(tdls_peer->rssi_jiffies +
+		    (MWIFIEX_AUTO_TDLS_IDLE_TIME * HZ))) {
 			tdls_peer->rssi = 0;
 			tdls_peer->do_discover = true;
 			priv->check_tdls_tx = true;
drivers/net/wireless/marvell/mwl8k.c +2 -1
index 864a2ba..9efe825
@@ -24,6 +24,7 @@
 #include <linux/moduleparam.h>
 #include <linux/firmware.h>
 #include <linux/workqueue.h>
+#include <linux/jiffies.h>
 
 #define MWL8K_DESC	"Marvell TOPDOG(R) 802.11 Wireless Network Driver"
 #define MWL8K_NAME	KBUILD_MODNAME
@@ -1880,7 +1881,7 @@ static inline void mwl8k_tx_count_packet(struct ieee80211_sta *sta, u8 tid)
 	 * packets ever exceeds the ampdu_min_traffic threshold, we will allow
 	 * an ampdu stream to be started.
 	 */
-	if (jiffies - tx_stats->start_time > HZ) {
+	if (time_is_before_jiffies(tx_stats->start_time + HZ)) {
 		tx_stats->pkts = 0;
 		tx_stats->start_time = 0;
 	} else
Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · Qing Wang

From: Wang Qing <[email protected]>

Use the helper function time_is_{before,after}_jiffies() to improve code readability.

One patch per driver, please. One for mwifiex and another for mwl8k.

Patch set to Changes Requested.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches