1 // SPDX-License-Identifier: GPL-2.0 2 3 #include <linux/bitops.h> 4 #include <linux/find.h> 5 6 __rust_helper 7 void rust_helper___set_bit(unsigned long nr, unsigned long *addr) 8 { 9 __set_bit(nr, addr); 10 } 11 12 __rust_helper 13 void rust_helper___clear_bit(unsigned long nr, unsigned long *addr) 14 { 15 __clear_bit(nr, addr); 16 } 17 18 __rust_helper 19 void rust_helper_set_bit(unsigned long nr, volatile unsigned long *addr) 20 { 21 set_bit(nr, addr); 22 } 23 24 __rust_helper 25 void rust_helper_clear_bit(unsigned long nr, volatile unsigned long *addr) 26 { 27 clear_bit(nr, addr); 28 } 29 30 /* 31 * The rust_helper_ prefix is intentionally omitted below so that the 32 * declarations in include/linux/find.h are compatible with these helpers. 33 * 34 * Note that the below #ifdefs mean that the helper is only created if C does 35 * not provide a definition. 36 */ 37 #ifdef find_first_zero_bit 38 __rust_helper 39 unsigned long _find_first_zero_bit(const unsigned long *p, unsigned long size) 40 { 41 return find_first_zero_bit(p, size); 42 } 43 #endif /* find_first_zero_bit */ 44 45 #ifdef find_next_zero_bit 46 __rust_helper 47 unsigned long _find_next_zero_bit(const unsigned long *addr, 48 unsigned long size, unsigned long offset) 49 { 50 return find_next_zero_bit(addr, size, offset); 51 } 52 #endif /* find_next_zero_bit */ 53 54 #ifdef find_first_bit 55 __rust_helper 56 unsigned long _find_first_bit(const unsigned long *addr, unsigned long size) 57 { 58 return find_first_bit(addr, size); 59 } 60 #endif /* find_first_bit */ 61 62 #ifdef find_next_bit 63 __rust_helper 64 unsigned long _find_next_bit(const unsigned long *addr, unsigned long size, 65 unsigned long offset) 66 { 67 return find_next_bit(addr, size, offset); 68 } 69 #endif /* find_next_bit */ 70