File tree Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 14
14
#include <linux/ethtool.h>
15
15
#include <linux/firmware.h>
16
16
#include <linux/jiffies.h>
17
+ #include <linux/jump_label.h>
17
18
#include <linux/mdio.h>
18
19
#include <linux/phy.h>
19
20
#include <linux/refcount.h>
Original file line number Diff line number Diff line change 12
12
#include "build_assert.c"
13
13
#include "build_bug.c"
14
14
#include "err.c"
15
+ #include "jump_label.c"
15
16
#include "kunit.c"
16
17
#include "mutex.c"
17
18
#include "page.c"
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: GPL-2.0
2
+
3
+ /*
4
+ * Copyright (C) 2024 Google LLC.
5
+ */
6
+
7
+ #include <linux/jump_label.h>
8
+
9
+ #ifndef CONFIG_JUMP_LABEL
10
+ int rust_helper_static_key_count (struct static_key * key )
11
+ {
12
+ return static_key_count (key );
13
+ }
14
+ #endif
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: GPL-2.0
2
+
3
+ // Copyright (C) 2024 Google LLC.
4
+
5
+ //! Logic for static keys.
6
+ //!
7
+ //! C header: [`include/linux/jump_label.h`](srctree/include/linux/jump_label.h).
8
+
9
+ /// Branch based on a static key.
10
+ ///
11
+ /// Takes three arguments:
12
+ ///
13
+ /// * `key` - the path to the static variable containing the `static_key`.
14
+ /// * `keytyp` - the type of `key`.
15
+ /// * `field` - the name of the field of `key` that contains the `static_key`.
16
+ ///
17
+ /// # Safety
18
+ ///
19
+ /// The macro must be used with a real static key defined by C.
20
+ #[ macro_export]
21
+ macro_rules! static_branch_unlikely {
22
+ ( $key: path, $keytyp: ty, $field: ident) => { {
23
+ let _key: * const $keytyp = :: core:: ptr:: addr_of!( $key) ;
24
+ let _key: * const $crate:: bindings:: static_key_false = :: core:: ptr:: addr_of!( ( * _key) . $field) ;
25
+ let _key: * const $crate:: bindings:: static_key = _key. cast( ) ;
26
+
27
+ $crate:: bindings:: static_key_count( _key. cast_mut( ) ) > 0
28
+ } } ;
29
+ }
30
+ pub use static_branch_unlikely;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ pub mod error;
36
36
pub mod firmware;
37
37
pub mod init;
38
38
pub mod ioctl;
39
+ pub mod jump_label;
39
40
#[ cfg( CONFIG_KUNIT ) ]
40
41
pub mod kunit;
41
42
pub mod list;
You can’t perform that action at this time.
0 commit comments