From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 2/8] drm/i915: Make the intel_device_info structure kept in dev_priv writable Date: Mon, 10 Feb 2014 17:55:19 +0100 Message-ID: <20140210165519.GX17001@phenom.ffwll.local> References: <1391800374-24904-1-git-send-email-damien.lespiau@intel.com> <1391800374-24904-3-git-send-email-damien.lespiau@intel.com> <20140210090911.GL17001@phenom.ffwll.local> <20140210125329.GH3891@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ea0-f178.google.com (mail-ea0-f178.google.com [209.85.215.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 20F1FFA2D7 for ; Mon, 10 Feb 2014 08:55:27 -0800 (PST) Received: by mail-ea0-f178.google.com with SMTP id a15so3106656eae.23 for ; Mon, 10 Feb 2014 08:55:27 -0800 (PST) Content-Disposition: inline In-Reply-To: <20140210125329.GH3891@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, Feb 10, 2014 at 02:53:29PM +0200, Ville Syrj=E4l=E4 wrote: > On Mon, Feb 10, 2014 at 10:09:11AM +0100, Daniel Vetter wrote: > > On Fri, Feb 07, 2014 at 07:12:48PM +0000, Damien Lespiau wrote: > > > Turns out it'd be nice to change some device information at run-time = or simply > > > have some code to fill in the info struct instead of having to declar= e the > > > values in 30+ structures. > > > = > > > What prompted this change is handling fused out display/pipe and twea= king > > > num_pipes at run-time, but I'm quite sure we'll find other flags/limi= ts to > > > stick into dev_priv->info. > > > = > > > Most of the changes were done with a sed: > > > sed -i -e 's/dev_priv->info->/dev_priv->info./g' drivers/gpu/drm/i915= /*[ch] > > > = > > > with a few tweaks to make it all work: > > > - Change the field definition in struct drm_i915_private > > > - adjust i915_dump_device_info() > > > - adjust i915_driver_load() > > > - adjust the INTEL_INFO() macro > > > = > > > v2: cast the info pointer returned by INTEL_INFO() to be const to cat= ch > > > uses that would modify the structure post-initialization. > > > (Ville Syrj=E4l=E4) > > > = > > > v3: Redo the patch onto latest drm-nightly, > > > Keep the info field const to catch post initialization writes > > > instead of the v2 solution, > > > Use a direct structure copy for the initial info initialization to > > > use the compiler type safety (Ville Syrj=E4l=E4) > > > = > > > Reviewed-by: Mika Kuoppala (for v2) > > > Reviewed-by: Ville Syrj=E4l=E4 (for v= 2) > > > Signed-off-by: Damien Lespiau > > = > > [snip] > > = > > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i= 915_drv.h > > > index 728b9c3..f66699f 100644 > > > --- a/drivers/gpu/drm/i915/i915_drv.h > > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > > @@ -1390,7 +1390,7 @@ typedef struct drm_i915_private { > > > struct drm_device *dev; > > > struct kmem_cache *slab; > > > = > > > - const struct intel_device_info *info; > > > + const struct intel_device_info info; > > = > > Since every access should now go through the macro I think it'd be good= to > > give this a __ prefix to make it clear that users better think twice > > before using it. Maybe as a patch on top of all this? > = > No. Everyone having to use the macro was a requirement of the v2 patch. > With v3 that requirement was lifted since the const is right there on > the struct itself. I think that was the whole point of v3. Oops, I've missed that v3 has the const even on the dev_priv->info pointer now. No need for any gratious rename fests then imo. -Daniel -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch