Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3716875ybg; Fri, 25 Oct 2019 08:01:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2lLF/aKPyzS2Tk9s3I2ZXfh65/vsqrb+2aulZuhid4f922YRLJhprbdByKomdN85wcD9o X-Received: by 2002:a50:d70c:: with SMTP id t12mr4493770edi.252.1572015715172; Fri, 25 Oct 2019 08:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572015715; cv=none; d=google.com; s=arc-20160816; b=Szs6FDYavCuyPjuDhLT0k98kEJllk7bVwfD432PXO0+oFO9cBMKxAbs2pYkkcA6RHy ifQcT1CgWR33IXZ3WJq6MNoYqXszsDXF7pUk7jpYoRDPG9maCaAy0VzFIEEWFpV9loK6 HLvFPOCEDNc4Vs6HnhMw+ztkyUxRt/36JFLMvtXJzMeSnCEfKuwX7tK+XZoenaaXtQ7u +qHDFl+tudLC++szFD5M5sjT6tASAe+h68ghAfVKYKiW+0t0mELDkoThaUfBPMBoQk2V 3muqy+tMZi9hMzHr32trk6M6Tl1e1z2K9aOVgYYMjE5kGbrZPv6mF9JdqTA0qerff6Z4 lMOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=/FOiZXAHnPLnKrIWF7nXcO/G6UyMroPOng6GabrjXtM=; b=U57oduHTvQaKvAUFo+qJ9KSJIMOcv9rqYhA2mFUMxY19Xqt44mdqkGJ5yjVziu/3FV OIEgUS1VGHeq+oh3SmmK2CXLotrzHMgHwIiiXdQNgkA3H2E9LIew+QPHqNFlaWUpI8+X XQf2sA0NWnZcq8TnJTlsXAckj6guzPWqF4p3IdDMjqipEYIrtxHcq/O5y4xsFHGctoyV 7IgGUH3QL3z5SLH66q25WK7OeA7ySzAq0mM8UrILYvGnrKWdnE9YtM/tsV80V0IKCrB7 6Q/5Is25+KHsey0Od7ShiI0B3iJtT7md0AHmMIlqC6g68qDJqdgk+2d6sqroFooOlI+R 6mhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23si1419404ejc.1.2019.10.25.08.01.23; Fri, 25 Oct 2019 08:01:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504044AbfJXSTn (ORCPT + 99 others); Thu, 24 Oct 2019 14:19:43 -0400 Received: from ms.lwn.net ([45.79.88.28]:42668 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504042AbfJXSTn (ORCPT ); Thu, 24 Oct 2019 14:19:43 -0400 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: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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. > > 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/kerneldoc.py > index 1159405cb920..0689f9c37f1e 100644 > --- a/Documentation/sphinx/kerneldoc.py > +++ b/Documentation/sphinx/kerneldoc.py > @@ -59,9 +59,10 @@ class KernelDocDirective(Directive): > optional_arguments = 4 > option_spec = { > 'doc': directives.unchanged_required, > - 'functions': directives.unchanged, > 'export': directives.unchanged, > 'internal': directives.unchanged, > + 'identifiers': directives.unchanged, > + 'functions': directives.unchanged, # alias of 'identifiers' > } > has_content = False > > @@ -71,6 +72,7 @@ class KernelDocDirective(Directive): > > filename = env.config.kerneldoc_srctree + '/' + self.arguments[0] > export_file_patterns = [] > + identifiers = None > > # Tell sphinx of the dependency > env.note_dependency(os.path.abspath(filename)) > @@ -86,19 +88,22 @@ class KernelDocDirective(Directive): > export_file_patterns = str(self.options.get('internal')).split() > elif 'doc' in self.options: > cmd += ['-function', str(self.options.get('doc'))] > + elif 'identifiers' in self.options: > + identifiers = self.options.get('identifiers').split() > elif 'functions' in self.options: > - functions = self.options.get('functions').split() > - if functions: > - for f in functions: > - cmd += ['-function', f] > - else: > - cmd += ['-no-doc-sections'] > + identifiers = 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=='' and identifiers==None . Thanks, jon > for pattern in export_file_patterns: > for f in glob.glob(env.config.kerneldoc_srctree + '/' + pattern): > env.note_dependency(os.path.abspath(f)) > cmd += ['-export-file', f] > > + if identifiers: > + for i in identifiers: > + cmd += ['-function', i] > + elif identifiers is not None: > + cmd += ['-no-doc-sections'] > + > cmd += [filename] > > try: