Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp579225imm; Wed, 22 Aug 2018 09:03:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxGqf7BdQt3u2s/dKo6ytqS7mI4524Uz+XMt//jerwwyM6c49vPMVtg7xFt6LXVb6WLZ1QI X-Received: by 2002:a63:d80f:: with SMTP id b15-v6mr51994960pgh.347.1534953813139; Wed, 22 Aug 2018 09:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534953813; cv=none; d=google.com; s=arc-20160816; b=kZiOCdOebEV14iWcxeV9cIEexxjowLRyLlBZIJ7MZa9wnZ1//PhBUr7CDfckl2RGg2 U65aOb9U1UE3L1YHiF3l4+Wqdqcrgs4t9XGQQ+swYd6/8iGN3PnXyJCI/5ONM7WhjFA+ a1D5Ote7pG2184bFTKAHPcrfG5vbSOYY3k9A90smlyo4yQzXmVXXCn7aBnz+SGDOEIct nfgRnHQqjgCVlZ80HdenVC5JpJOGLz8tPVKeNsSCLfSbprWwhQpMzcj11kcNv2JQ1tnK wXxXT3fdn33YwZZ0l/MpgAQ9uNPfXstkNJiMb/ZsXP4nB5NhYDnBmtHrfQg9KrcmQCOu RerA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=MbBeEKj8ySTTa/LXfH/zp+wcqZF9HTmj+cW5KB5VXcA=; b=K1IJWvhkSjKQdMMWRbPzR/B+j3PaahGaxuZZ7QIQzIUylykr98zuErg/yBaorPeqF4 m05TmPICIuCAxt+iKB22fv+qnVrXQyJd8oN+UUZpvJuXUqkBG68hZBTbWaSAC7JwkdA/ uDV5G7J7Z8ilyDTDAGNEzCPyz++QaI/BAQiqiDCDnHc+nliPcT/iY6IlLK65ircb3omp VAT0wcL4fV8eE/4ZHZVh1wdLDf4F3+SBWPNqY1c3Dokf1FG/GN+CzMJyPfreaSwelfuu od1VADwQD3LRhkhAyyaruKM+pD+cGc/r0IxYNzcFY1j7DwqiM2YpEINzgfpo0e8B40sb m9pQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8-v6si2177982pfw.89.2018.08.22.09.03.16; Wed, 22 Aug 2018 09:03:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729314AbeHVSYl (ORCPT + 99 others); Wed, 22 Aug 2018 14:24:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:38319 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729158AbeHVSYl (ORCPT ); Wed, 22 Aug 2018 14:24:41 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Aug 2018 07:59:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,274,1531810800"; d="scan'208";a="226779895" Received: from eengestr-old.ld.intel.com (HELO intel.com) ([10.103.238.209]) by orsmga004.jf.intel.com with ESMTP; 22 Aug 2018 07:59:24 -0700 Date: Wed, 22 Aug 2018 15:59:24 +0100 From: Eric Engestrom 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 Subject: Re: [PATCH] drm/fourcc: Add DOC: overview comment 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 Content-Disposition: inline In-Reply-To: <20180821164416.GA11553@e107564-lin.cambridge.arm.com> Organization: Intel Corp UK User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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