public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915: Use clamp_t() when limiting cur_delay
Date: Thu, 7 Nov 2013 10:56:52 -0800	[thread overview]
Message-ID: <20131107105652.5686d50f@jbarnes-desktop> (raw)
In-Reply-To: <1383847069-3554-2-git-send-email-ville.syrjala@linux.intel.com>

On Thu,  7 Nov 2013 19:57:49 +0200
ville.syrjala@linux.intel.com wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> 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>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 54338cf..b940ebe 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))

What a nice little helper.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2013-11-07 18:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07 17:57 [PATCH 1/2] drm/i915: Kill vlv_update_rps_cur_delay() ville.syrjala
2013-11-07 17:57 ` [PATCH 2/2] drm/i915: Use clamp_t() when limiting cur_delay ville.syrjala
2013-11-07 18:56   ` Jesse Barnes [this message]
2013-11-07 19:05     ` Daniel Vetter
2013-11-07 18:55 ` [PATCH 1/2] drm/i915: Kill vlv_update_rps_cur_delay() Jesse Barnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131107105652.5686d50f@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox