diff options
author | Javi Merino <javi.merino@arm.com> | 2015-04-16 15:43:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:03:55 -0400 |
commit | ee3c86f356b4dfc130442d0bd68ff2da2bd60538 (patch) | |
tree | fa372a4856b72801ff2cf8a7fe81310031b0b77f | |
parent | aa7762010a4340a12a87a54b7a402adcdce8cfa9 (diff) |
cpuidle: menu: use DIV_ROUND_CLOSEST_ULL()
Now that the kernel provides DIV_ROUND_CLOSEST_ULL(), drop the internal
implementation and use the kernel one.
Signed-off-by: Javi Merino <javi.merino@arm.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 40580794e23d..b8a5fa15ca24 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -190,12 +190,6 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices); | |||
190 | 190 | ||
191 | static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev); | 191 | static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev); |
192 | 192 | ||
193 | /* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */ | ||
194 | static u64 div_round64(u64 dividend, u32 divisor) | ||
195 | { | ||
196 | return div_u64(dividend + (divisor / 2), divisor); | ||
197 | } | ||
198 | |||
199 | /* | 193 | /* |
200 | * Try detecting repeating patterns by keeping track of the last 8 | 194 | * Try detecting repeating patterns by keeping track of the last 8 |
201 | * intervals, and checking if the standard deviation of that set | 195 | * intervals, and checking if the standard deviation of that set |
@@ -317,7 +311,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
317 | * operands are 32 bits. | 311 | * operands are 32 bits. |
318 | * Make sure to round up for half microseconds. | 312 | * Make sure to round up for half microseconds. |
319 | */ | 313 | */ |
320 | data->predicted_us = div_round64((uint64_t)data->next_timer_us * | 314 | data->predicted_us = DIV_ROUND_CLOSEST_ULL((uint64_t)data->next_timer_us * |
321 | data->correction_factor[data->bucket], | 315 | data->correction_factor[data->bucket], |
322 | RESOLUTION * DECAY); | 316 | RESOLUTION * DECAY); |
323 | 317 | ||