Skip to content

Commit 42e8606

Browse files
ethancedwards8intel-lab-lkp
authored andcommitted
rust/kernel/faux: mark Registration methods inline
When building the kernel on Arch Linux using on x86_64 with tools: $ rustc --version rustc 1.84.0 (9fc6b4312 2025-01-07) $ cargo --version cargo 1.84.0 (66221abde 2024-11-19) $ clang --version clang version 19.1.7 Target: x86_64-pc-linux-gnu The following symbols are generated: $ nm vmlinux | rg ' _R' | rustfilt | rg faux ffffffff81959ae0 T <kernel::faux::Registration>::new ffffffff81959b40 T <kernel::faux::Registration as core::ops::drop::Drop>::drop However, these Rust symbols are wrappers around bindings in the C faux code. Inlining these functions removes the middle-man wrapper function After applying this patch, the above function signatures disappear. Link: Rust-for-Linux#1145 Signed-off-by: Ethan Carter Edwards <[email protected]>
1 parent fc2f191 commit 42e8606

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

rust/kernel/faux.rs

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub struct Registration(NonNull<bindings::faux_device>);
2424

2525
impl Registration {
2626
/// Create and register a new faux device with the given name.
27+
#[inline]
2728
pub fn new(name: &CStr) -> Result<Self> {
2829
// SAFETY:
2930
// - `name` is copied by this function into its own storage
@@ -50,6 +51,7 @@ impl AsRef<device::Device> for Registration {
5051
}
5152

5253
impl Drop for Registration {
54+
#[inline]
5355
fn drop(&mut self) {
5456
// SAFETY: `self.0` is a valid registered faux_device via our type invariants.
5557
unsafe { bindings::faux_device_destroy(self.as_raw()) }

0 commit comments

Comments
 (0)