summaryrefslogtreecommitdiff
path: root/rust/helpers/bitops.c
diff options
context:
space:
mode:
authorBurak Emir <bqe@google.com>2025-09-08 07:21:52 +0000
committerYury Norov (NVIDIA) <yury.norov@gmail.com>2025-09-22 15:52:44 -0400
commit6cf93a9ed39e9f86c7f69c28078500270e70a695 (patch)
tree521639cd45f9023568dc2911271839de4784e854 /rust/helpers/bitops.c
parent0452b4ab2961093f23bb289b0112351b917fb23c (diff)
rust: add bindings for bitops.h
Makes atomic set_bit and clear_bit inline functions as well as the non-atomic variants __set_bit and __clear_bit available to Rust. Adds a new MAINTAINERS section BITOPS API BINDINGS [RUST]. Suggested-by: Alice Ryhl <aliceryhl@google.com> Suggested-by: Yury Norov <yury.norov@gmail.com> Signed-off-by: Burak Emir <bqe@google.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Acked-by: Yury Norov (NVIDIA) <yury.norov@gmail.com> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Diffstat (limited to 'rust/helpers/bitops.c')
-rw-r--r--rust/helpers/bitops.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/rust/helpers/bitops.c b/rust/helpers/bitops.c
new file mode 100644
index 000000000000..5d0861d29d3f
--- /dev/null
+++ b/rust/helpers/bitops.c
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/bitops.h>
+
+void rust_helper___set_bit(unsigned long nr, unsigned long *addr)
+{
+ __set_bit(nr, addr);
+}
+
+void rust_helper___clear_bit(unsigned long nr, unsigned long *addr)
+{
+ __clear_bit(nr, addr);
+}
+
+void rust_helper_set_bit(unsigned long nr, volatile unsigned long *addr)
+{
+ set_bit(nr, addr);
+}
+
+void rust_helper_clear_bit(unsigned long nr, volatile unsigned long *addr)
+{
+ clear_bit(nr, addr);
+}