On Thu, 12 May 2011 17:40:42 -0700, Keith Packard <[email protected]> wrote:
> On Thu, 12 May 2011 22:17:16 +0100, Chris Wilson <[email protected]>
> wrote:
>
> > Keith complained that GMBUSx + reg_offset was ugly. An alternative
> > naming scheme which is more consistent with the reset of the code base
> > is to store the address of the GMBUS0 and then reference each of the
> > GMBUSx registers as an offset from GMBUS0.
>
> This looks completely wrong -- GMBUS1 is GMBUS0 + 4, not GMBUS0 + 1.
That was shameful.
> How about a simple function that computes the GMBUS register address
> based on the device and a number? like:
>
> static int intel_gmbus_reg(struct drm_device *dev, int reg) {
> int base = HAS_PCH_SPLIT(dev) ? PCH_GMBUS0 : GMBUS0;
>
> return base + reg * 4;
And how about something like:
#define I915_GMBUS_WRITE(reg, val) \
I915_WRITE(intel_gmbus_reg(dev_priv->dev, reg), val)
I915_GMBUS_WRITE(0, val);
For the body?
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx