Skip to content

Commit abf2111

Browse files
Darksonnfbq
authored andcommitted
rust: helpers: Move #define __rust_helper out of atomic.c
In order to support inline helpers [1], we need to have __rust_helper defined for all helper files. Current we are lucky that atomic.c is the first file in helpers.c, but this is fragile. Thus, move it to helpers.c. [boqun: Reword the commit message and apply file hash changes] Link: https://lore.kernel.org/r/20260105-define-rust-helper-v2-0-51da5f454a67@google.com [1] Signed-off-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Link: https://patch.msgid.link/20260107-move-rust_helper-define-v1-1-4109d58ef275@google.com
1 parent 5628f05 commit abf2111

3 files changed

Lines changed: 3 additions & 11 deletions

File tree

rust/helpers/atomic.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
#include <linux/atomic.h>
1313

14-
// TODO: Remove this after INLINE_HELPERS support is added.
15-
#ifndef __rust_helper
16-
#define __rust_helper
17-
#endif
18-
1914
__rust_helper int
2015
rust_helper_atomic_read(const atomic_t *v)
2116
{
@@ -1037,4 +1032,4 @@ rust_helper_atomic64_dec_if_positive(atomic64_t *v)
10371032
}
10381033

10391034
#endif /* _RUST_ATOMIC_API_H */
1040-
// 615a0e0c98b5973a47fe4fa65e92935051ca00ed
1035+
// e4edb6174dd42a265284958f00a7cea7ddb464b1

rust/helpers/helpers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* Sorted alphabetically.
88
*/
99

10+
#define __rust_helper
11+
1012
#include "atomic.c"
1113
#include "atomic_ext.c"
1214
#include "auxiliary.c"

scripts/atomic/gen-rust-atomic-helpers.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ cat << EOF
4747
4848
#include <linux/atomic.h>
4949
50-
// TODO: Remove this after INLINE_HELPERS support is added.
51-
#ifndef __rust_helper
52-
#define __rust_helper
53-
#endif
54-
5550
EOF
5651

5752
grep '^[a-z]' "$1" | while read name meta args; do

0 commit comments

Comments
 (0)