diff mbox

Fix compute error while enable self-refresh

Message ID 1300418301-26092-1-git-send-email-yuanhan.liu@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yuanhan Liu March 18, 2011, 3:18 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3106c0d..dc52dc1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3885,7 +3885,7 @@  static bool g4x_compute_srwm(struct drm_device *dev,
 
 static inline bool single_plane_enabled(unsigned int mask)
 {
-	return mask && (mask & -mask) == 0;
+	return mask && (mask & (mask - 1)) == 0;
 }
 
 static void g4x_update_wm(struct drm_device *dev)
@@ -3910,7 +3910,7 @@  static void g4x_update_wm(struct drm_device *dev)
 
 	plane_sr = cursor_sr = 0;
 	if (single_plane_enabled(enabled) &&
-	    g4x_compute_srwm(dev, ffs(enabled) - 1,
+	    g4x_compute_srwm(dev, fls(enabled) - 1,
 			     sr_latency_ns,
 			     &g4x_wm_info,
 			     &g4x_cursor_wm_info,
@@ -4335,7 +4335,7 @@  static void ironlake_update_wm(struct drm_device *dev)
 
 	if (!single_plane_enabled(enabled))
 		return;
-	enabled = ffs(enabled) - 1;
+	enabled = fls(enabled) - 1;
 
 	/* WM1 */
 	if (!ironlake_compute_srwm(dev, 1, enabled,
@@ -4421,7 +4421,7 @@  static void sandybridge_update_wm(struct drm_device *dev)
 
 	if (!single_plane_enabled(enabled))
 		return;
-	enabled = ffs(enabled) - 1;
+	enabled = fls(enabled) - 1;
 
 	/* WM1 */
 	if (!ironlake_compute_srwm(dev, 1, enabled,