diff mbox

drm/i915: Optimize DIV_ROUND_CLOSEST call

Message ID 20120903211446.707a75af@endymion.delvare (mailing list archive)
State New, archived
Headers show

Commit Message

Jean Delvare Sept. 3, 2012, 7:14 p.m. UTC
From: Jean Delvare <khali@linux-fr.org>
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 <khali@linux-fr.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
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(-)
diff mbox

Patch

--- 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));