From ae25d606c9d4f3cf437dd0868a2bc8ae50b2fee9 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Thu, 30 May 2024 15:29:53 +1000 Subject: [PATCH] doc: _scripts: gen_devicetree_rest: skip empty vendors Don't create output sections for vendors without bindings. This only affects the `Unknown vendor` and `Generic or vendor-independent` vendors, which are populated by default but do not necessarily contain any entries. Signed-off-by: Jordan Yates --- doc/_scripts/gen_devicetree_rest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/_scripts/gen_devicetree_rest.py b/doc/_scripts/gen_devicetree_rest.py index dbd6227d972..99151b34d7a 100644 --- a/doc/_scripts/gen_devicetree_rest.py +++ b/doc/_scripts/gen_devicetree_rest.py @@ -322,7 +322,9 @@ def write_bindings_rst(vnd_lookup, out_dir): .. rst-class:: rst-columns ''', string_io) - for vnd in vnd_lookup.vnd2bindings: + for vnd, bindings in vnd_lookup.vnd2bindings.items(): + if len(bindings) == 0: + continue print(f'- :ref:`{vnd_lookup.target(vnd)}`', file=string_io) print_block('''\ @@ -358,6 +360,9 @@ def write_bindings_rst(vnd_lookup, out_dir): title += f' ({vnd})' underline = '=' * len(title) + if len(bindings) == 0: + continue + print_block(f'''\ .. _{vnd_lookup.target(vnd)}: