From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03E04CA9EBD for ; Thu, 24 Oct 2019 18:19:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C354020684 for ; Thu, 24 Oct 2019 18:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C354020684 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lwn.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 43CF16B0007; Thu, 24 Oct 2019 14:19:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C5EA6B0008; Thu, 24 Oct 2019 14:19:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B4836B000A; Thu, 24 Oct 2019 14:19:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 035E66B0007 for ; Thu, 24 Oct 2019 14:19:44 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 68820181AEF21 for ; Thu, 24 Oct 2019 18:19:44 +0000 (UTC) X-FDA: 76079491488.17.jewel43_1ac1f66946205 X-HE-Tag: jewel43_1ac1f66946205 X-Filterd-Recvd-Size: 4470 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Oct 2019 18:19:43 +0000 (UTC) Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id B4C682F5; Thu, 24 Oct 2019 18:19:41 +0000 (UTC) Date: Thu, 24 Oct 2019 12:19:40 -0600 From: Jonathan Corbet To: Changbin Du Cc: linux-pci@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-crypto@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-wireless@vger.kernel.org, linux-fpga@vger.kernel.org, linux-usb@vger.kernel.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Matthew Wilcox , jani.nikula@linux.intel.com, Thomas Zimmermann Subject: Re: [PATCH v2] kernel-doc: rename the kernel-doc directive 'functions' to 'identifiers' Message-ID: <20191024121940.1d6a64df@lwn.net> In-Reply-To: <20191020131717.28990-1-changbin.du@gmail.com> References: <20191020131717.28990-1-changbin.du@gmail.com> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, 20 Oct 2019 21:17:17 +0800 Changbin Du wrote: > The 'functions' directive is not only for functions, but also works for > structs/unions. So the name is misleading. This patch renames it to > 'identifiers', which specific the functions/types to be included in > documentation. We keep the old name as an alias of the new one before > all documentation are updated. >=20 > Signed-off-by: Changbin Du So I think this is basically OK, but I have one more request... [...] > diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/k= erneldoc.py > index 1159405cb920..0689f9c37f1e 100644 > --- a/Documentation/sphinx/kerneldoc.py > +++ b/Documentation/sphinx/kerneldoc.py > @@ -59,9 +59,10 @@ class KernelDocDirective(Directive): > optional_arguments =3D 4 > option_spec =3D { > 'doc': directives.unchanged_required, > - 'functions': directives.unchanged, > 'export': directives.unchanged, > 'internal': directives.unchanged, > + 'identifiers': directives.unchanged, > + 'functions': directives.unchanged, # alias of 'identifiers' > } > has_content =3D False > =20 > @@ -71,6 +72,7 @@ class KernelDocDirective(Directive): > =20 > filename =3D env.config.kerneldoc_srctree + '/' + self.argumen= ts[0] > export_file_patterns =3D [] > + identifiers =3D None > =20 > # Tell sphinx of the dependency > env.note_dependency(os.path.abspath(filename)) > @@ -86,19 +88,22 @@ class KernelDocDirective(Directive): > export_file_patterns =3D str(self.options.get('internal'))= .split() > elif 'doc' in self.options: > cmd +=3D ['-function', str(self.options.get('doc'))] > + elif 'identifiers' in self.options: > + identifiers =3D self.options.get('identifiers').split() > elif 'functions' in self.options: > - functions =3D self.options.get('functions').split() > - if functions: > - for f in functions: > - cmd +=3D ['-function', f] > - else: > - cmd +=3D ['-no-doc-sections'] > + identifiers =3D self.options.get('functions').split() Rather than do this, can you just change the elif line to read: elif ('identifiers' in self.options) or ('functions' in self.options)= : ...then leave the rest of the code intact? It keeps the logic together, and avoids the confusing distinction between identifiers=3D=3D'' and identifiers=3D=3DNone . Thanks, jon > for pattern in export_file_patterns: > for f in glob.glob(env.config.kerneldoc_srctree + '/' + pa= ttern): > env.note_dependency(os.path.abspath(f)) > cmd +=3D ['-export-file', f] > =20 > + if identifiers: > + for i in identifiers: > + cmd +=3D ['-function', i] > + elif identifiers is not None: > + cmd +=3D ['-no-doc-sections'] > + > cmd +=3D [filename] > =20 > try: