From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Engestrom Subject: Re: [PATCH] drm/fourcc: Add DOC: overview comment Date: Wed, 22 Aug 2018 15:59:24 +0100 Message-ID: <20180822145924.GA13763@intel.com> References: <20180821161611.10424-1-brian.starkey@arm.com> <20180821162639.GA21697@bombadil.infradead.org> <20180821164416.GA11553@e107564-lin.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <20180821164416.GA11553@e107564-lin.cambridge.arm.com> Sender: linux-kernel-owner@vger.kernel.org To: Brian Starkey Cc: Matthew Wilcox , alexandru-cosmin.gheorghe@arm.com, corbet@lwn.net, airlied@linux.ie, daniel.vetter@ffwll.ch, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, seanpaul@chromium.org, liviu.dudau@arm.com, ayan.halder@arm.com List-Id: dri-devel@lists.freedesktop.org On Tuesday, 2018-08-21 17:44:17 +0100, Brian Starkey wrote: > Hi Matthew, > > On Tue, Aug 21, 2018 at 09:26:39AM -0700, Matthew Wilcox wrote: > > On Tue, Aug 21, 2018 at 05:16:11PM +0100, Brian Starkey wrote: > > > There's a number of things which haven't previously been documented > > > around the usage of format modifiers. Capture the current > > > understanding in an overview comment and add it to the rst > > > documentation. > > > > > > Ideally, the generated documentation would also include documentation > > > of all of the #defines, but the kernel-doc system doesn't currently > > > support kernel-doc comments on #define constants. > > > > Can you turn them into enums? This seems to work ok: > > > > -/* color index */ > > -#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */ > > - > > -/* 8 bpp Red */ > > -#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */ > > +enum { > > + /* color index */ > > + DRM_FORMAT_C8 = fourcc_code('C', '8', ' ', ' '), /* [7:0] C */ > > + /* 8 bpp Red */ > > + DRM_FORMAT_R8 = fourcc_code('R', '8', ' ', ' '), /* [7:0] R */ > > +}; > > > > but I appreciate this is user API and maybe there's some code out there > > that does #ifndef DRM_FORMAT_C8 ... > > Thanks for the suggestion, Daniel did mention the same. However, > unfortunately I don't think we can safely change the UAPI header in > this manner. You could get the best of both worlds by doing both: enum { foo = fourcc(...), bar = fourcc(...), } #define foo foo #define bar bar It would mean a bit more code though, but that way these would now be enums (with all the advantages of enums vs plain literals) and still pass #ifdef checks :) (BTW, on the "maybe there's some code that does #ifdef": I can tell you there is indeed, having written this myself for an out-of-tree driver for customer-modified kernels that may contain additional formats) > > Cheers, > -Brian > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel