drm/i915: Use clamp_t() when limiting cur_delay
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 7 Nov 2013 17:57:49 +0000 (19:57 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 7 Nov 2013 19:04:53 +0000 (20:04 +0100)
Make the cur_delay limiting code a bit less prone to typo errors
by using clamp_t().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_irq.c

index c6176f337452da68437a856d8b28468da16e7a2e..e14285bafbd45319ecf63a7d6d6263374e5f2793 100644 (file)
@@ -966,10 +966,8 @@ static void gen6_pm_rps_work(struct work_struct *work)
        /* sysfs frequency interfaces may have snuck in while servicing the
         * interrupt
         */
-       if (new_delay < (int)dev_priv->rps.min_delay)
-               new_delay = dev_priv->rps.min_delay;
-       if (new_delay > (int)dev_priv->rps.max_delay)
-               new_delay = dev_priv->rps.max_delay;
+       new_delay = clamp_t(int, new_delay,
+                           dev_priv->rps.min_delay, dev_priv->rps.max_delay);
        dev_priv->rps.last_adj = new_delay - dev_priv->rps.cur_delay;
 
        if (IS_VALLEYVIEW(dev_priv->dev))