Skip to contentSkip to conversation

xdrgen: Address some checkpatch whitespace complaints

PATCH In review Chuck Lever 2 participants 2 messages Dec 1, 2025 – Dec 2, 2025

Subsystems (3)
lore
Share & tools
lore

Chuck Lever

author maintainer
#0 lore raw

PATCH 1/1 xdrgen: Address some checkpatch whitespace complaints

From: Chuck Lever <[email protected]>

This is a roll-up of three template fixes that eliminate noise from checkpatch output so that it's easier to spot non-trivial problems.

To follow conventional kernel C style, when a union declaration is marked with "pragma public", there should be a blank line between the emitted "union xxx { ... };" and the decoder and encoder function declarations.

---

CHECK: Please use a blank line after function/struct/union/enum declarations +};
+typedef enum createmode3 createmode3;

Make xdrgen output more "checkpatch friendly" -- add a blank line after enum definitions.

---

CHECK: Please don't use multiple blank lines
+
+

Eliminate a source of checkpatch.pl warnings in xdrgen-generated C header files.

---
 tools/net/sunrpc/xdrgen/templates/C/enum/declaration/enum.j2    | 1 -
 tools/net/sunrpc/xdrgen/templates/C/enum/definition/close.j2    | 1 +
 tools/net/sunrpc/xdrgen/templates/C/enum/definition/close_be.j2 | 1 +
 tools/net/sunrpc/xdrgen/templates/C/union/definition/close.j2   | 1 +
 4 files changed, 3 insertions(+), 1 deletion(-)
tools/net/sunrpc/xdrgen/templates/C/enum/declaration/enum.j2 +0 -1
index d1405c7c5354..c7ae506076bb 100644
@@ -1,4 +1,3 @@
 {# SPDX-License-Identifier: GPL-2.0 #}
-
 bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr);
 bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value);
tools/net/sunrpc/xdrgen/templates/C/enum/definition/close.j2 +1 -0
index a07586cbee17..446266ad6d17 100644
@@ -1,3 +1,4 @@
 {# SPDX-License-Identifier: GPL-2.0 #}
 };
+
 typedef enum {{ name }} {{ name }};
tools/net/sunrpc/xdrgen/templates/C/enum/definition/close_be.j2 +1 -0
index 2c18948bddf7..cfeee2287e68 100644
@@ -1,3 +1,4 @@
 {# SPDX-License-Identifier: GPL-2.0 #}
 };
+
 typedef __be32 {{ name }};
tools/net/sunrpc/xdrgen/templates/C/union/definition/close.j2 +1 -0
index 01d716d0099e..5fc1937ba774 100644
@@ -3,6 +3,7 @@
 };
 {%- if name in public_apis %}
 
+
 bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, struct {{ name }} *ptr);
 bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const struct {{ name }} *ptr);
 {%- endif -%}
Signature · 1 line
2.52.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 68 lines · Chuck Lever

From: Chuck Lever <[email protected]>

This is a roll-up of three template fixes that eliminate noise from checkpatch output so that it's easier to spot non-trivial problems.

To follow conventional kernel C style, when a union declaration is marked with "pragma public", there should be a blank line between the emitted "union xxx { ... };" and the decoder and encoder function declarations.

---

CHECK: Please use a blank line after function/struct/union/enum declarations

(quoted diff) +2 -0
+};
+typedef enum createmode3 createmode3;

Make xdrgen output more "checkpatch friendly" -- add a blank line after enum definitions.

---

CHECK: Please don't use multiple blank lines

(quoted diff) +2 -0
+
+

Eliminate a source of checkpatch.pl warnings in xdrgen-generated C header files.

---
 tools/net/sunrpc/xdrgen/templates/C/enum/declaration/enum.j2    | 1 -
 tools/net/sunrpc/xdrgen/templates/C/enum/definition/close.j2    | 1 +
 tools/net/sunrpc/xdrgen/templates/C/enum/definition/close_be.j2 | 1 +
 tools/net/sunrpc/xdrgen/templates/C/union/definition/close.j2   | 1 +
 4 files changed, 3 insertions(+), 1 deletion(-)
tools/net/sunrpc/xdrgen/templates/C/enum/declaration/enum.j2 +0 -1
index d1405c7c5354..c7ae506076bb 100644
@@ -1,4 +1,3 @@
 {# SPDX-License-Identifier: GPL-2.0 #}
-
 bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr);
 bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value);
tools/net/sunrpc/xdrgen/templates/C/enum/definition/close.j2 +1 -0
index a07586cbee17..446266ad6d17 100644
@@ -1,3 +1,4 @@
 {# SPDX-License-Identifier: GPL-2.0 #}
 };
+
 typedef enum {{ name }} {{ name }};
tools/net/sunrpc/xdrgen/templates/C/enum/definition/close_be.j2 +1 -0
index 2c18948bddf7..cfeee2287e68 100644
@@ -1,3 +1,4 @@
 {# SPDX-License-Identifier: GPL-2.0 #}
 };
+
 typedef __be32 {{ name }};
tools/net/sunrpc/xdrgen/templates/C/union/definition/close.j2 +0 -0
index 01d716d0099e..5fc1937ba774 100644

tools/net/sunrpc/xdrgen/templates/C/union/definition/close.j2 line 9

Quoted 7 lines
tools/net/sunrpc/xdrgen/templates/C/union/definition/close.j2 +1 -0
@@ -3,6 +3,7 @@
 };
 {%- if name in public_apis %}
 
+
 bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, struct {{ name }} *ptr);
 bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const struct {{ name }} *ptr);
 {%- endif -%}