aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/libipw_wx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ipw2x00/libipw_wx.c')
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_wx.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/wireless/ipw2x00/libipw_wx.c b/drivers/net/wireless/ipw2x00/libipw_wx.c
index dfbadb3b9bd5..3c0812db030a 100644
--- a/drivers/net/wireless/ipw2x00/libipw_wx.c
+++ b/drivers/net/wireless/ipw2x00/libipw_wx.c
@@ -43,6 +43,16 @@ static const char *ieee80211_modes[] = {
43 "?", "a", "b", "ab", "g", "ag", "bg", "abg" 43 "?", "a", "b", "ab", "g", "ag", "bg", "abg"
44}; 44};
45 45
46static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
47{
48 unsigned long end = jiffies;
49
50 if (end >= start)
51 return jiffies_to_msecs(end - start);
52
53 return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1);
54}
55
46#define MAX_CUSTOM_LEN 64 56#define MAX_CUSTOM_LEN 64
47static char *ieee80211_translate_scan(struct ieee80211_device *ieee, 57static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
48 char *start, char *stop, 58 char *start, char *stop,
@@ -216,8 +226,8 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
216 iwe.cmd = IWEVCUSTOM; 226 iwe.cmd = IWEVCUSTOM;
217 p = custom; 227 p = custom;
218 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), 228 p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
219 " Last beacon: %dms ago", 229 " Last beacon: %ums ago",
220 jiffies_to_msecs(jiffies - network->last_scanned)); 230 elapsed_jiffies_msecs(network->last_scanned));
221 iwe.u.data.length = p - custom; 231 iwe.u.data.length = p - custom;
222 if (iwe.u.data.length) 232 if (iwe.u.data.length)
223 start = iwe_stream_add_point(info, start, stop, &iwe, custom); 233 start = iwe_stream_add_point(info, start, stop, &iwe, custom);
@@ -277,15 +287,15 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
277 time_after(network->last_scanned + ieee->scan_age, jiffies)) 287 time_after(network->last_scanned + ieee->scan_age, jiffies))
278 ev = ieee80211_translate_scan(ieee, ev, stop, network, 288 ev = ieee80211_translate_scan(ieee, ev, stop, network,
279 info); 289 info);
280 else 290 else {
281 IEEE80211_DEBUG_SCAN("Not showing network '%s (" 291 IEEE80211_DEBUG_SCAN("Not showing network '%s ("
282 "%pM)' due to age (%dms).\n", 292 "%pM)' due to age (%ums).\n",
283 print_ssid(ssid, network->ssid, 293 print_ssid(ssid, network->ssid,
284 network->ssid_len), 294 network->ssid_len),
285 network->bssid, 295 network->bssid,
286 jiffies_to_msecs(jiffies - 296 elapsed_jiffies_msecs(
287 network-> 297 network->last_scanned));
288 last_scanned)); 298 }
289 } 299 }
290 300
291 spin_unlock_irqrestore(&ieee->lock, flags); 301 spin_unlock_irqrestore(&ieee->lock, flags);