wifi: mwifiex: Convert to use jiffies macro
PATCH v2 1/1 wifi: mwifiex: Convert to use jiffies macro
Use time_after macro instead of using
jiffies directly to handle wraparound.
The modifications made compared to the previous version are as follows:
1. Added a typecast to unsigned long for rssi_jiffies
to resolve the compilation error.
Signed-off-by Chen Yufan <[email protected]>
--- drivers/net/wireless/marvell/mwifiex/tdls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/tdls.c +2 -2
@@ -1439,8 +1439,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_after (jiffies, (unsigned long )tdls_peer->rssi_jiffies + +MWIFIEX_AUTO_TDLS_IDLE_TIME *HZ )) { tdls_peer->rssi =0 ; tdls_peer->do_discover = true; priv->check_tdls_tx = true;
Signature · 1 line
2.39.0
Brian Norris
maintainerQuoted 5 lines · Chen Yufan
Use
time_aftermacro instead of using
jiffies directly to handle wraparound.
The modifications made compared to the previous version are as follows:
1. Added a typecast to unsigned long forrssi_jiffies
to resolve the compilation error.
Can we just change the type in mwifiex_auto_tdls_peer::rssi_jiffies? Fewer casts is generally better.
Brian
Quoted 24 lines
Signed-off-by Chen Yufan <[email protected]>--- drivers/net/wireless/marvell/mwifiex/tdls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/marvell/mwifiex/tdls.c +2
-2@@ -1439,8 +1439,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_after (jiffies, (unsigned long )tdls_peer->rssi_jiffies + +MWIFIEX_AUTO_TDLS_IDLE_TIME *HZ )) { tdls_peer->rssi =0 ; tdls_peer->do_discover = true; priv->check_tdls_tx = true;Signature · 1 line
2.39.0