Commit 6cf93a9e authored by Burak Emir's avatar Burak Emir Committed by Yury Norov (NVIDIA)
Browse files

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: default avatarAlice Ryhl <aliceryhl@google.com>
Suggested-by: default avatarYury Norov <yury.norov@gmail.com>
Signed-off-by: default avatarBurak Emir <bqe@google.com>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Acked-by: default avatarYury Norov (NVIDIA) <yury.norov@gmail.com>
Signed-off-by: default avatarYury Norov (NVIDIA) <yury.norov@gmail.com>
parent 0452b4ab
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4316,6 +4316,11 @@ F: include/linux/bitops.h
F:	lib/test_bitops.c
F:	tools/*/bitops*
BITOPS API BINDINGS [RUST]
M:	Yury Norov <yury.norov@gmail.com>
S:	Maintained
F:	rust/helpers/bitops.c
BLINKM RGB LED DRIVER
M:	Jan-Simon Moeller <jansimon.moeller@gmx.de>
S:	Maintained

rust/helpers/bitops.c

0 → 100644
+23 −0
Original line number Diff line number Diff line
// 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);
}
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@

#include "auxiliary.c"
#include "bitmap.c"
#include "bitops.c"
#include "blk.c"
#include "bug.c"
#include "build_assert.c"