From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751604AbbCTLPj (ORCPT ); Fri, 20 Mar 2015 07:15:39 -0400 Received: from foss.arm.com ([217.140.101.70]:39839 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbbCTLPf (ORCPT ); Fri, 20 Mar 2015 07:15:35 -0400 From: Javi Merino To: akpm@linux-foundation.org Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Javi Merino , "Rafael J. Wysocki" , Mel Gorman , Stephen Hemminger Subject: [PATCH 3/4] cpuidle: menu: use DIV_ROUND_CLOSEST_ULL() Date: Fri, 20 Mar 2015 11:14:42 +0000 Message-Id: <1426850083-11049-4-git-send-email-javi.merino@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426850083-11049-1-git-send-email-javi.merino@arm.com> References: <1426850083-11049-1-git-send-email-javi.merino@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the kernel provides DIV_ROUND_CLOSEST_ULL(), drop the internal implementation and use the kernel one. Cc: "Rafael J. Wysocki" Cc: Mel Gorman Cc: Stephen Hemminger Signed-off-by: Javi Merino --- drivers/cpuidle/governors/menu.c | 8 +------- 1 file changed, 1 insertion(+), 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); static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev); -/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */ -static u64 div_round64(u64 dividend, u32 divisor) -{ - return div_u64(dividend + (divisor / 2), divisor); -} - /* * Try detecting repeating patterns by keeping track of the last 8 * 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) * operands are 32 bits. * Make sure to round up for half microseconds. */ - data->predicted_us = div_round64((uint64_t)data->next_timer_us * + data->predicted_us = DIV_ROUND_CLOSEST_ULL((uint64_t)data->next_timer_us * data->correction_factor[data->bucket], RESOLUTION * DECAY); -- 1.9.1