From: Ville Syrjälä Date: Thu, 7 Nov 2013 17:57:49 +0000 (+0200) Subject: drm/i915: Use clamp_t() when limiting cur_delay X-Git-Tag: firefly_0821_release~176^2~4523^2~90^2~60 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1272e7b854e768ede5279de57b78a54cb39f5da5;p=firefly-linux-kernel-4.4.55.git drm/i915: Use clamp_t() when limiting cur_delay Make the cur_delay limiting code a bit less prone to typo errors by using clamp_t(). Signed-off-by: Ville Syrjälä Reviewed-by: Jesse Barnes Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index c6176f337452..e14285bafbd4 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -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))