Re: [PATCH v5 2/5] kernel-doc: add support to handle DEFINE_ variables
From: Randy Dunlap
Date: Wed Nov 26 2025 - 20:27:36 EST
Hi Mauro,
On 11/24/25 1:57 AM, Mauro Carvalho Chehab wrote:
> Improve the parser and output plugin to work with macros,
> adding support for the common pattern of using DEFINE_*
> to create variables.
>
I can't get this one to work: it is completely ignored AFAICT:
from the init/kdoc-globals-test.c file that I provided earlier:
/**
* var rtnl_mutex - historical global lock for networking control operations.
*
* @rtnl_mutex is used to serialize rtnetlink requests
* and protect all kernel internal data structures related to networking.
*
* See Documentation/networking/netdevices.rst for details.
* Often known as the rtnl_lock, although rtnl_lock is a kernel function.
*/
static DEFINE_MUTEX(rtnl_mutex);
If I remove the beginning "static " and change its name to test_mutex, kdoc reports:
WARNING: ../init/kdoc-globals-test.c:100 DEFINE_MUTEX(test_mutex);: can't parse variable
I have both of these mutexes in my test file now. Here is the second one:
/**
* var test_mutex - historical global lock for networking control operations.
*
* @test_mutex is used to serialize rtnetlink requests
* and protect all kernel internal data structures related to networking.
*
* See Documentation/networking/netdevices.rst for details.
* Often known as the test_lock, although test_lock is a kernel function.
*/
DEFINE_MUTEX(test_mutex);
--
~Randy