summaryrefslogtreecommitdiff
path: root/rust/bindings
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2026-09-25 08:25:29 +0900
committerAndreas Hindborg <a.hindborg@kernel.org>2026-09-28 17:10:45 +0200
commit4ebfdb2c8b28eb8ef85b4e4ce65e55bd5a4df8d5 (patch)
treedd72896acf7026faffd1fff3c7c7c85055e2108e /rust/bindings
parent6a8e2c63f2fece3828ac09e4e434666de842acfe (diff)
downloadlinux-next-4ebfdb2c8b28eb8ef85b4e4ce65e55bd5a4df8d5.tar.gz
linux-next-4ebfdb2c8b28eb8ef85b4e4ce65e55bd5a4df8d5.zip
rust: bindings: set HZ to CONFIG_HZ
include/uapi/asm-generic/param.h defines HZ as __USER_HZ and include/asm-generic/param.h then sets it to CONFIG_HZ. bindgen keeps the first definition of a macro and ignores a later #undef, so the generated binding is __USER_HZ. Redefine HZ in rust/bindings/lib.rs, the same way compat_ptr_ioctl is redefined there. Nothing in the tree reads bindings::HZ today, so this prevents accidental misuse rather than fixing a bug. Suggested-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com> Link: https://msgid.link/20260924232530.446588-2-tomo@flapping.org Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Diffstat (limited to 'rust/bindings')
-rw-r--r--rust/bindings/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs
index 812f8e5a08d5..c17e6c2b775f 100644
--- a/rust/bindings/lib.rs
+++ b/rust/bindings/lib.rs
@@ -81,3 +81,8 @@ pub const compat_ptr_ioctl: Option<
None
}
};
+
+// `bindgen` keeps the first definition of a macro and ignores a later `#undef`.
+// The generated `HZ` is therefore `__USER_HZ` from
+// `include/uapi/asm-generic/param.h`, not `CONFIG_HZ`.
+pub const HZ: u32 = CONFIG_HZ;