mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: corbet@lwn.net, skhan@linuxfoundation.org, mchehab@kernel.org,
	aleksandr.loktionov@intel.com, bvanassche@acm.org,
	tudor.ambarus@linaro.org
Subject: Re: [PATCH] docs: kdoc: strip DOMAIN_NS() wrapper in function prototypes
Date: Thu, 1 Oct 2026 21:28:11 -0700	[thread overview]
Message-ID: <a6baf8b0-1ce0-4ee7-a5ea-b50bd314c7c5@infradead.org> (raw)
In-Reply-To: <20261002041520.42061-1-emmaonana18@gmail.com>



On 10/1/26 9:15 PM, Omokefe Emmanuel Onanaroghene wrote:
> kernel-doc fails to parse functions whose names are wrapped in the
> DOMAIN_NS() namespace macro, e.g. in
> drivers/iommu/generic_pt/iommu_pt.h:217:
> 
>   ... expecting prototype for iova_to_phys(). Prototype was for
>   DOMAIN_NS() instead
> 
> function_xforms is the designated place for unwrapping function-name
> macros, but it has no entry for DOMAIN_NS(), so the macro name is kept
> as the prototype and the real name leaks into the parameter list.
> 
> Add a transform expanding DOMAIN_NS(op) to op, following the existing
> DEFINE_IDTENTRY_IRQ precedent.
> 
> Add a regression test for the wrapped iova_to_phys() declaration.
> 
> Signed-off-by: Omokefe Emmanuel Onanaroghene <emmaonana18@gmail.com>

Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  tools/lib/python/kdoc/xforms_lists.py |  6 ++++++
>  tools/unittests/test_kdoc_parser.py   | 22 ++++++++++++++++++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/tools/lib/python/kdoc/xforms_lists.py b/tools/lib/python/kdoc/xforms_lists.py
> index e3dda2fe8a53..5e8bd9117895 100644
> --- a/tools/lib/python/kdoc/xforms_lists.py
> +++ b/tools/lib/python/kdoc/xforms_lists.py
> @@ -91,6 +91,12 @@ class CTransforms:
>          (CMatch("__diagnose_as"), ""),
>          (CMatch("DECL_BUCKET_PARAMS"), r"\1, \2"),
>          (CMatch("DEFINE_IDTENTRY_IRQ"), r"static void \1(struct pt_regs *regs, u32 vector)"),
> +        #
> +        # DOMAIN_NS() wraps a function name with a namespace prefix
> +        # (see drivers/iommu/generic_pt/iommu_pt.h). Unwrap it so the
> +        # real function name is parsed.
> +        #
> +        (CMatch("DOMAIN_NS"), r"\1"),
>          (CMatch("__cond_acquires"), ""),
>          (CMatch("__cond_releases"), ""),
>          (CMatch("__acquires"), ""),
> diff --git a/tools/unittests/test_kdoc_parser.py b/tools/unittests/test_kdoc_parser.py
> index c4a76ed13dbc..4b47a858824a 100755
> --- a/tools/unittests/test_kdoc_parser.py
> +++ b/tools/unittests/test_kdoc_parser.py
> @@ -418,6 +418,28 @@ class TestSelfValidate(GenerateKdocItem):
>          """
>          self.run_test(self.SOURCE, [self.DEFAULT.copy()], self.EXPORTS)
>  
> +class TestDomainNs(GenerateKdocItem):
> +    def test_domain_ns_wrapped_function(self):
> +        source = """
> +            /**
> +             * iova_to_phys() - Return the output address for the given IOVA
> +             * @domain: Table to query
> +             * @iova: IO virtual address to query
> +             */
> +            phys_addr_t DOMAIN_NS(iova_to_phys)(struct iommu_domain *domain,
> +                                                dma_addr_t iova);
> +        """
> +
> +        kernel_doc = KernelDoc(self.config, "test.c", self.xforms)
> +        patcher = patch('builtins.open', new_callable=mock_open,
> +                        read_data=dedent(source))
> +        with patcher:
> +            _, entries = kernel_doc.parse_kdoc()
> +
> +        self.assertEqual(len(entries), 1)
> +        self.assertEqual(entries[0].name, "iova_to_phys")
> +        self.assertEqual(entries[0].warnings, [])
> +
>  #
>  # Class and logic to create dynamic tests from YAML
>  #

-- 
~Randy

  reply	other threads:[~2026-10-02  4:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  4:15 Omokefe Emmanuel Onanaroghene
2026-10-02  4:28 ` Randy Dunlap [this message]
2026-10-14 17:22 ` Jonathan Corbet
2026-10-14 22:47   ` Omokefe Emmanuel Onanaroghene
2026-10-15  0:53     ` Omokefe Emmanuel Onanaroghene

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=a6baf8b0-1ce0-4ee7-a5ea-b50bd314c7c5@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=aleksandr.loktionov@intel.com \
    --cc=bvanassche@acm.org \
    --cc=corbet@lwn.net \
    --cc=emmaonana18@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tudor.ambarus@linaro.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®