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=-8.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 34728CA9EA0 for ; Fri, 25 Oct 2019 14:48:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D802721929 for ; Fri, 25 Oct 2019 14:48:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ReQEnplZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D802721929 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6E64E6B0003; Fri, 25 Oct 2019 10:48:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 694CF6B0006; Fri, 25 Oct 2019 10:48:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 584016B0007; Fri, 25 Oct 2019 10:48:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 368F76B0003 for ; Fri, 25 Oct 2019 10:48:08 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id CC480181AEF15 for ; Fri, 25 Oct 2019 14:48:07 +0000 (UTC) X-FDA: 76082587014.22.eyes42_811cc32fba725 X-HE-Tag: eyes42_811cc32fba725 X-Filterd-Recvd-Size: 7151 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Oct 2019 14:48:07 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id z11so2627260wro.11 for ; Fri, 25 Oct 2019 07:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bIQBfe8sGIHTcc6sIk8ML0XGqqJRWtOG/huxYjSxgWs=; b=ReQEnplZs6d9r7FMszuAt1KQpVhgBAK8HrNTFjUqY3S/9APV1+HGvrsZ9waq7e63YU qE3MBI4hqWqVJcX+VWmtAW85YKN71otDbfGbheixnIP6tSrWow7JIdFnGpXtiV+mVJW2 1p2ctbskyMZMfpkAuSXvh/NwSIRIncEVf4MMrb16d505nLujE9HTPHxu4LuAIaDSZ+Jc KyD8GrKirgOQpcezDEDjZuvpDgE4yTBKNJS+69u7yUoDohsPtX/u+wyEaGIbvTZHormM 1LsppGHi80Arm2rQS0fl8o4nF9UjLZIsJPeKNNAtOJQk0Dc1AvH/QKIDvuZYoU6aXOrF VoIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bIQBfe8sGIHTcc6sIk8ML0XGqqJRWtOG/huxYjSxgWs=; b=l2xhFRoreQ1xFGCFWMKP6+HthCW+SFgdzkpZN/2PCU82rOTjiSS3B1/mVxmPaM7t7C truW8cLyRR4oNL0K91uq30Ee78gcMOTuOoj7K9h3tomqVlA7v5yzKc7PnS/TV4OhbYwA j+jFuym3svr/j1+zCAdfn2kaTiZFug1kECAmka+binBmIvKzS9srlpZn5E+8ImrMhHvu OObFccVGH6y5Yu/2dgTKA5fFB+/2j9oOH21GhK3GTpGmo2t2pKRSpGgoLRLqrf873TrH A3QwAohzlgs2J22y2gqfIxyMqUqbwTFCHyU960hdpqwS9GSsXKrreSZ9kGGNqZ7XHRHC apdA== X-Gm-Message-State: APjAAAX5Nlu4LAXSMh9mQxf65uqw2NAo1vX5P20pYB42EsCPSDUguZJU tP+SC9efNA8JUG6Z17aUIbA= X-Google-Smtp-Source: APXvYqxsX3C8tseMrdTDPvXw+m20Jy/sW7m38w3vpts8ZabQ38lGcQ4VQLB8VI+iJPUaxLQS52CZqA== X-Received: by 2002:a5d:4847:: with SMTP id n7mr3349140wrs.398.1572014885771; Fri, 25 Oct 2019 07:48:05 -0700 (PDT) Received: from mail.google.com ([104.238.174.53]) by smtp.gmail.com with ESMTPSA id 26sm2126489wmf.20.2019.10.25.07.48.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 07:48:05 -0700 (PDT) Date: Fri, 25 Oct 2019 14:48:03 +0000 From: Changbin Du To: Jani Nikula Cc: Jonathan Corbet , Changbin Du , 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 , Thomas Zimmermann Subject: Re: [PATCH v2] kernel-doc: rename the kernel-doc directive 'functions' to 'identifiers' Message-ID: <20191025144802.uixg2crhw6h7gghq@mail.google.com> References: <20191020131717.28990-1-changbin.du@gmail.com> <20191024121940.1d6a64df@lwn.net> <87woctb9cj.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87woctb9cj.fsf@intel.com> User-Agent: NeoMutt/20180716-508-7c9a6d 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 Fri, Oct 25, 2019 at 09:57:48AM +0300, Jani Nikula wrote: > On Thu, 24 Oct 2019, Jonathan Corbet wrote: > > 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 . > > I think the problem is you still need to distinguish between the two for > the get('functions') part. > > One option is to rename 'functions' to 'identifiers' in the above block, > and put something like this above the whole if ladder (untested): > > # backward compat > if 'functions' in self.options: > if 'identifiers' in self.options: > kernellog.warn(env.app, "fail") This will miss the content of 'functions' directive if both exist in same doc. > else: > self.options.set('identifiers', self.options.get('functions')) > > BR, > Jani. > After comparing, I still perfer my original code which is simpler. :) > > -- > Jani Nikula, Intel Open Source Graphics Center -- Cheers, Changbin Du