From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Ben Widawsky <ben@bwidawsk.net>,
f@chad-versace.us, Arjan van de Ven <arjan@linux.intel.com>,
Ben Widawsky <benjamin.widawsky@intel.com>
Subject: Re: [PATCH v4] drm/i915: rc6 in sysfs
Date: Wed, 11 Apr 2012 23:10:05 +0100 [thread overview]
Message-ID: <1334182209_374087@CP5-2952> (raw)
In-Reply-To: <1334132085_361270@CP5-2952>
On Wed, 11 Apr 2012 09:14:43 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> I'm down to just bikeshedding over useless lines of code which do not
> even add visual clarity...
>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Oops, need to learn to spot 64-bit divides which become an issue on
32-bit builds.
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 2319f06..f1b5108 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -35,14 +35,12 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
{
struct drm_i915_private *dev_priv = dev->dev_private;
u64 raw_time; /* 32b value may overflow during fixed point math */
- u32 residency;
if (!intel_enable_rc6(dev))
return 0;
- raw_time = I915_READ(reg) * 128ULL;
- residency = DIV_ROUND_CLOSEST(raw_time, 1000) / 100;
- return residency;
+ raw_time = I915_READ(reg) * 128ULL + 500;
+ return do_div(raw_time, 100000);
}
static ssize_t
--
1.7.9.5
--
Chris Wilson, Intel Open Source Technology Centre
next prev parent reply other threads:[~2012-04-11 22:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-11 4:17 [PATCH v4] drm/i915: rc6 in sysfs Ben Widawsky
2012-04-11 8:14 ` Chris Wilson
2012-04-11 9:51 ` Daniel Vetter
2012-04-11 22:10 ` Chris Wilson [this message]
2012-04-11 22:37 ` Daniel Vetter
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=1334182209_374087@CP5-2952 \
--to=chris@chris-wilson.co.uk \
--cc=arjan@linux.intel.com \
--cc=ben@bwidawsk.net \
--cc=benjamin.widawsky@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=f@chad-versace.us \
--cc=intel-gfx@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.