[PATCH 4/4] docs: sphinx: Add support :nosymbols: to exclude specific symbols

From: Sean Christopherson
Date: Fri Apr 05 2019 - 17:45:18 EST


Add :nosymbols: so that documentation of symbols can be organized in the
final output of makedocs. For example, files that define a large number
of symbols may want to categorize their symbols. Another example is
SGX, which introduces a uapi header that defines structs for ioctls and
for a new vDSO function[1]. Ideally, the documentation for the vDSO
struct will be placed into a different section.

[1] https://lkml.kernel.org/r/20190320162119.4469-25-jarkko.sakkinen@xxxxxxxxxxxxxxx

Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
---
Documentation/sphinx/kerneldoc.py | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/sphinx/kerneldoc.py b/Documentation/sphinx/kerneldoc.py
index c52b6caac356..d1eb1907858b 100644
--- a/Documentation/sphinx/kerneldoc.py
+++ b/Documentation/sphinx/kerneldoc.py
@@ -48,6 +48,7 @@ class KernelDocDirective(Directive):
option_spec = {
'doc': directives.unchanged_required,
'functions': directives.unchanged,
+ 'nosymbols': directives.unchanged,
'export': directives.unchanged,
'internal': directives.unchanged,
}
@@ -81,6 +82,10 @@ class KernelDocDirective(Directive):
cmd += ['-symbol', f]
else:
cmd += ['-no-doc-sections']
+ elif 'nosymbols' in self.options:
+ symbols = self.options.get('nosymbols').split()
+ for s in symbols:
+ cmd += ['-nosymbol', s]

for pattern in export_file_patterns:
for f in glob.glob(env.config.kerneldoc_srctree + '/' + pattern):
--
2.21.0