Commit 8e9310c1 authored by Bob Copeland's avatar Bob Copeland Committed by John W. Linville

mac80211: pid: replace open-coded msecs_to_jiffies

Code directly scaling by HZ and rounding can be more efficiently
and clearly performed with msecs_to_jiffies.
Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 1f447808
...@@ -157,9 +157,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo, ...@@ -157,9 +157,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
/* In case nothing happened during the previous control interval, turn /* In case nothing happened during the previous control interval, turn
* the sharpening factor on. */ * the sharpening factor on. */
period = (HZ * pinfo->sampling_period + 500) / 1000; period = msecs_to_jiffies(pinfo->sampling_period);
if (!period)
period = 1;
if (jiffies - spinfo->last_sample > 2 * period) if (jiffies - spinfo->last_sample > 2 * period)
spinfo->sharp_cnt = pinfo->sharpen_duration; spinfo->sharp_cnt = pinfo->sharpen_duration;
...@@ -252,9 +250,7 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba ...@@ -252,9 +250,7 @@ static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_ba
} }
/* Update PID controller state. */ /* Update PID controller state. */
period = (HZ * pinfo->sampling_period + 500) / 1000; period = msecs_to_jiffies(pinfo->sampling_period);
if (!period)
period = 1;
if (time_after(jiffies, spinfo->last_sample + period)) if (time_after(jiffies, spinfo->last_sample + period))
rate_control_pid_sample(pinfo, sband, sta, spinfo); rate_control_pid_sample(pinfo, sband, sta, spinfo);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment