Skip to content

Commit e0d4140

Browse files
committed
Merge tag 'bitmap-for-6.19-rc5' of https://github.com/norov/linux
Pull bitmap fix from Yury Norov: "Fix Rust build for architectures implementing their own find_bit() ops (arm and m68k)" * tag 'bitmap-for-6.19-rc5' of https://github.com/norov/linux: rust: bitops: fix missing _find_* functions on 32-bit ARM
2 parents d19954e + 6a06987 commit e0d4140

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

rust/helpers/bitops.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22

33
#include <linux/bitops.h>
4+
#include <linux/find.h>
45

56
void rust_helper___set_bit(unsigned long nr, unsigned long *addr)
67
{
@@ -21,3 +22,44 @@ void rust_helper_clear_bit(unsigned long nr, volatile unsigned long *addr)
2122
{
2223
clear_bit(nr, addr);
2324
}
25+
26+
/*
27+
* The rust_helper_ prefix is intentionally omitted below so that the
28+
* declarations in include/linux/find.h are compatible with these helpers.
29+
*
30+
* Note that the below #ifdefs mean that the helper is only created if C does
31+
* not provide a definition.
32+
*/
33+
#ifdef find_first_zero_bit
34+
__rust_helper
35+
unsigned long _find_first_zero_bit(const unsigned long *p, unsigned long size)
36+
{
37+
return find_first_zero_bit(p, size);
38+
}
39+
#endif /* find_first_zero_bit */
40+
41+
#ifdef find_next_zero_bit
42+
__rust_helper
43+
unsigned long _find_next_zero_bit(const unsigned long *addr,
44+
unsigned long size, unsigned long offset)
45+
{
46+
return find_next_zero_bit(addr, size, offset);
47+
}
48+
#endif /* find_next_zero_bit */
49+
50+
#ifdef find_first_bit
51+
__rust_helper
52+
unsigned long _find_first_bit(const unsigned long *addr, unsigned long size)
53+
{
54+
return find_first_bit(addr, size);
55+
}
56+
#endif /* find_first_bit */
57+
58+
#ifdef find_next_bit
59+
__rust_helper
60+
unsigned long _find_next_bit(const unsigned long *addr, unsigned long size,
61+
unsigned long offset)
62+
{
63+
return find_next_bit(addr, size, offset);
64+
}
65+
#endif /* find_next_bit */

0 commit comments

Comments
 (0)