From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Packard Subject: Re: [PATCH 08/16] drm/i915/i2c: Convert from using GMBUS1 + reg_offset idiom to reg + 0 Date: Thu, 12 May 2011 17:40:42 -0700 Message-ID: References: <1305235044-9159-1-git-send-email-chris@chris-wilson.co.uk> <1305235044-9159-9-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1602600213==" Return-path: Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id 552049E744 for ; Thu, 12 May 2011 17:58:50 -0700 (PDT) In-Reply-To: <1305235044-9159-9-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1602600213== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Transfer-Encoding: quoted-printable On Thu, 12 May 2011 22:17:16 +0100, Chris Wilson = 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. 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 =3D HAS_PCH_SPLIT(dev) ? PCH_GMBUS0 : GMBUS0; return base + reg * 4; } =2D-=20 keith.packard@intel.com --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iD8DBQFNzH4KQp8BWwlsTdMRAujKAJ4nvx5afB1o//DZy8NTt7MeHJpKWgCgxeOI rN2aUZN+ATnfR796T0Y7iaI= =NEcz -----END PGP SIGNATURE----- --=-=-=-- --===============1602600213== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============1602600213==--