diff options
author | Nicholas Mc Guire <hofrat@osadl.org> | 2015-03-02 04:54:13 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-03-04 04:34:13 -0500 |
commit | cc57ac536a88604824aca1d3c874fd5252f1e867 (patch) | |
tree | 501f217c51bdf4f0ee7b5e7d10d9deec8ba01fc3 /net/mac80211/mesh_plink.c | |
parent | 64a8cef41a8ce694b59ec75ae52688f58925693c (diff) |
mesh_plink: use msecs_to_jiffies for proper time conversion
This is primarily an API consolidation and should make things more readable
it replaces var * HZ / 1000 by msecs_to_jiffies(var) which also handles
corner cases correctly.
There is a change of behavior as e.g. for HZ 100, t * HZ / 1000 will
return 0 for t < 10 but msecs_to_jiffies will return at least 1 always.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r-- | net/mac80211/mesh_plink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index b488e1859b18..4eefd5df5b05 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #define PLINK_GET_PLID(p) (p + 4) | 17 | #define PLINK_GET_PLID(p) (p + 4) |
18 | 18 | ||
19 | #define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \ | 19 | #define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \ |
20 | jiffies + HZ * t / 1000)) | 20 | jiffies + msecs_to_jiffies(t))) |
21 | 21 | ||
22 | enum plink_event { | 22 | enum plink_event { |
23 | PLINK_UNDEFINED, | 23 | PLINK_UNDEFINED, |
@@ -623,7 +623,7 @@ static void mesh_plink_timer(unsigned long data) | |||
623 | 623 | ||
624 | static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout) | 624 | static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout) |
625 | { | 625 | { |
626 | sta->plink_timer.expires = jiffies + (HZ * timeout / 1000); | 626 | sta->plink_timer.expires = jiffies + msecs_to_jiffies(timeout); |
627 | sta->plink_timer.data = (unsigned long) sta; | 627 | sta->plink_timer.data = (unsigned long) sta; |
628 | sta->plink_timer.function = mesh_plink_timer; | 628 | sta->plink_timer.function = mesh_plink_timer; |
629 | sta->plink_timeout = timeout; | 629 | sta->plink_timeout = timeout; |