From patchwork Mon Sep 3 19:14:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 1400771 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 7BBA1DF2AB for ; Mon, 3 Sep 2012 19:51:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 358019F0F8 for ; Mon, 3 Sep 2012 12:51:03 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 2153 seconds by postgrey-1.32 at gabe; Mon, 03 Sep 2012 21:50:51 CEST Received: from services.gcu-squad.org (zoneX.GCU-Squad.org [194.213.125.0]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DF529F0D5 for ; Mon, 3 Sep 2012 12:50:51 -0700 (PDT) Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=endymion.delvare) by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id 1T8c6n-0001eF-VS (TLSv1:AES128-SHA:128) (envelope-from ) ; Mon, 03 Sep 2012 21:14:54 +0200 Date: Mon, 3 Sep 2012 21:14:46 +0200 From: Jean Delvare To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915: Optimize DIV_ROUND_CLOSEST call Message-ID: <20120903211446.707a75af@endymion.delvare> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.7; x86_64-suse-linux-gnu) Mime-Version: 1.0 Cc: Daniel Vetter , Andrew Morton , Guenter Roeck X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Jean Delvare Subject: drm/i915: Optimize DIV_ROUND_CLOSEST call DIV_ROUND_CLOSEST is faster if the compiler knows it will only be dealing with unsigned dividends. Signed-off-by: Jean Delvare Cc: Guenter Roeck Cc: Andrew Morton Cc: Daniel Vetter Cc: David Airlie --- Daniel, I think we can safely assume ia_freq can't be negative? drivers/gpu/drm/i915/intel_pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- linux-3.6-rc3.orig/drivers/gpu/drm/i915/intel_pm.c 2012-08-28 14:46:22.000000000 +0200 +++ linux-3.6-rc3/drivers/gpu/drm/i915/intel_pm.c 2012-09-01 21:17:32.074619227 +0200 @@ -2499,7 +2499,8 @@ static void gen6_update_ring_freq(struct { struct drm_i915_private *dev_priv = dev->dev_private; int min_freq = 15; - int gpu_freq, ia_freq, max_ia_freq; + int gpu_freq; + unsigned int ia_freq, max_ia_freq; int scaling_factor = 180; WARN_ON(!mutex_is_locked(&dev->struct_mutex));