mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel-doc: add support for handling global variables
Date: Mon, 8 Sep 2025 23:22:13 -0700	[thread overview]
Message-ID: <5cec20da-b8a6-4db9-ab4f-78ec6b327d28@infradead.org> (raw)
In-Reply-To: <20250907233447.0cbe9954@foz.lan>



On 9/7/25 2:34 PM, Mauro Carvalho Chehab wrote:
> Em Sun,  7 Sep 2025 18:22:22 +0200
> Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu:
> 
>> Specially on kAPI, sometimes it is desirable to be able to
>> describe global variables that are part of kAPI.
>>
>> Documenting vars with Sphinx is simple, as we don't need
>> to parse a data struct. All we need is the variable
>> declaration and use natice C domain ::c:var: to format it
>> for us.
>>
>> Add support for it.
>>
>> Link: https://lore.kernel.org/linux-doc/491c3022-cef8-4860-a945-c9c4a3b63c09@infradead.org/T/#m947c25d95cb1d96a394410ab1131dc8e9e5013f1
>> Suggested-by: Randy Dunlap <rdunlap@infradead.org>
>> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> 
> Btw, this is still at RFC level, as, for the final version we need:
> 
> - to document this new kernel-doc feature;

Yes, I thought of that one.

> - to suppress (or keep) the end ";";

I'll need to see it, but I expect I would prefer to suppress it.

> - do some cleanups/improvements at the regex to ensure that it is generic
>   enough. For instance, the way it was defineded, it doesn't handle yet
>   variables with assigned values like:
> 	extern int foo = 5;
> - if it has a default non-zero value, should it be documented or not,
>   and, if so, how;

I think I came up with some examples (test cases) like these without even
knowing that you had singled them out as possible issues.

> - to decide if we add "extern" to all outputs, to none of them or if we
>   just follow what is at the documented declaration (the current
>   implementation does the latter;

Follow what is documented for now (as you have it).

> - to decide weather use "global"/"var" or something else.

Just stick with "global". It's fine.

> Also, it would be interesting to have a real case where we want
> to document kAPI variables.
> 
> Randy,
> 
> if you have some real case examples, perhaps you could pick this patch
> and add on a patch series after taking the above into consideration.

I just searched for some real case examples and came up with around 6 from
various source files. I put them into one source file that I will include
in a Documentation/ .rst file for testing and let you know how that goes.

Sorry for the delay. I've had some other things going on.

Thanks for working on the feature.

-- 
~Randy


  reply	other threads:[~2025-09-09  6:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-07 16:22 Mauro Carvalho Chehab
2025-09-07 21:34 ` Mauro Carvalho Chehab
2025-09-09  6:22   ` Randy Dunlap [this message]
2025-09-09 20:12     ` Mauro Carvalho Chehab
2025-09-09  7:27 ` Randy Dunlap
2025-09-09 15:57   ` Randy Dunlap
2025-09-09 16:18     ` Mauro Carvalho Chehab
2025-09-09 18:20       ` Randy Dunlap
2025-09-09 20:37         ` Mauro Carvalho Chehab
2025-09-09 19:58   ` Mauro Carvalho Chehab
2025-09-09 20:09     ` Mauro Carvalho Chehab
2025-09-09 21:06     ` Randy Dunlap
2025-09-09 23:09       ` Mauro Carvalho Chehab
2025-09-09 23:49         ` Randy Dunlap
2025-09-09 23:50           ` Randy Dunlap
2025-09-10  0:02             ` Randy Dunlap
2025-09-10  4:23               ` Mauro Carvalho Chehab
2025-09-10  5:59                 ` Randy Dunlap
2025-09-10  6:13                   ` Randy Dunlap
2025-09-10  8:54                     ` Mauro Carvalho Chehab
2025-11-15  0:50                       ` Randy Dunlap
2025-11-16 10:28                         ` Mauro Carvalho Chehab
2025-11-16 19:46                           ` Randy Dunlap
2025-11-17  9:45   ` Mauro Carvalho Chehab
2025-11-17 17:45     ` Randy Dunlap
2025-09-10  9:24 ` Jani Nikula
2025-09-10 12:13   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5cec20da-b8a6-4db9-ab4f-78ec6b327d28@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®