Skip to content

Commit

Permalink
net/mac80211/: Use time_* macros
Browse files Browse the repository at this point in the history
The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values.

So following patch implements usage of the time_after() macro, defined at linux/jiffies.h, which deals with wrapping correctly

Cc: linux-wireless@vger.kernel.org
Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
S.Çağlar Onur authored and John W. Linville committed Feb 29, 2008
1 parent ac2bf32 commit ab46623
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion net/mac80211/rc80211_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* published by the Free Software Foundation.
*/

#include <linux/jiffies.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/types.h>
Expand Down Expand Up @@ -175,7 +176,7 @@ static void rate_control_simple_tx_status(void *priv, struct net_device *dev,
rate_control_rate_dec(local, sta);
}

if (srctrl->avg_rate_update + 60 * HZ < jiffies) {
if (time_after(jiffies, srctrl->avg_rate_update + 60 * HZ)) {
srctrl->avg_rate_update = jiffies;
if (srctrl->tx_avg_rate_num > 0) {
#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
Expand Down
3 changes: 2 additions & 1 deletion net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* published by the Free Software Foundation.
*/

#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
Expand Down Expand Up @@ -767,7 +768,7 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata,
compare_ether_addr(hdr->addr2, f_hdr->addr2) != 0)
continue;

if (entry->first_frag_time + 2 * HZ < jiffies) {
if (time_after(jiffies, entry->first_frag_time + 2 * HZ)) {
__skb_queue_purge(&entry->skb_list);
continue;
}
Expand Down

0 comments on commit ab46623

Please sign in to comment.