aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel')
-rw-r--r--rust/kernel/allocator.rs41
-rw-r--r--rust/kernel/chrdev.rs2
-rw-r--r--rust/kernel/driver.rs2
-rw-r--r--rust/kernel/fs.rs2
4 files changed, 5 insertions, 42 deletions
diff --git a/rust/kernel/allocator.rs b/rust/kernel/allocator.rs
index 280676993074..cfb406e2a710 100644
--- a/rust/kernel/allocator.rs
+++ b/rust/kernel/allocator.rs
@@ -26,43 +26,6 @@ unsafe impl GlobalAlloc for KernelAllocator {
#[global_allocator]
static ALLOCATOR: KernelAllocator = KernelAllocator;
-// `rustc` only generates these for some crate types. Even then, we would need
-// to extract the object file that has them from the archive. For the moment,
-// let's generate them ourselves instead.
-//
-// Note that `#[no_mangle]` implies exported too, nowadays.
-#[allow(clippy::no_mangle_with_rust_abi)]
+// See <https://github.com/rust-lang/rust/pull/86844>.
#[no_mangle]
-fn __rust_alloc(size: usize, _align: usize) -> *mut u8 {
- unsafe { bindings::krealloc(core::ptr::null(), size, bindings::GFP_KERNEL) as *mut u8 }
-}
-
-#[allow(clippy::no_mangle_with_rust_abi)]
-#[no_mangle]
-fn __rust_dealloc(ptr: *mut u8, _size: usize, _align: usize) {
- unsafe { bindings::kfree(ptr as *const core::ffi::c_void) };
-}
-
-#[allow(clippy::no_mangle_with_rust_abi)]
-#[no_mangle]
-fn __rust_realloc(ptr: *mut u8, _old_size: usize, _align: usize, new_size: usize) -> *mut u8 {
- unsafe {
- bindings::krealloc(
- ptr as *const core::ffi::c_void,
- new_size,
- bindings::GFP_KERNEL,
- ) as *mut u8
- }
-}
-
-#[allow(clippy::no_mangle_with_rust_abi)]
-#[no_mangle]
-fn __rust_alloc_zeroed(size: usize, _align: usize) -> *mut u8 {
- unsafe {
- bindings::krealloc(
- core::ptr::null(),
- size,
- bindings::GFP_KERNEL | bindings::__GFP_ZERO,
- ) as *mut u8
- }
-}
+static __rust_no_alloc_shim_is_unstable: u8 = 0;
diff --git a/rust/kernel/chrdev.rs b/rust/kernel/chrdev.rs
index 5b1e083c23b9..71adb105b45d 100644
--- a/rust/kernel/chrdev.rs
+++ b/rust/kernel/chrdev.rs
@@ -160,7 +160,7 @@ impl<const N: usize> Registration<{ N }> {
});
}
- let mut inner = this.inner.as_mut().unwrap();
+ let inner = this.inner.as_mut().unwrap();
if inner.used == N {
return Err(EINVAL);
}
diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
index af42a773256e..d8f5f62022f7 100644
--- a/rust/kernel/driver.rs
+++ b/rust/kernel/driver.rs
@@ -196,7 +196,7 @@ pub struct IdTable<'a, T: RawDeviceId, U> {
_p: PhantomData<&'a U>,
}
-impl<T: RawDeviceId, U> const AsRef<T::RawType> for IdTable<'_, T, U> {
+impl<T: RawDeviceId, U> AsRef<T::RawType> for IdTable<'_, T, U> {
fn as_ref(&self) -> &T::RawType {
self.first
}
diff --git a/rust/kernel/fs.rs b/rust/kernel/fs.rs
index 1ba01629e9cd..8c0f61da3e39 100644
--- a/rust/kernel/fs.rs
+++ b/rust/kernel/fs.rs
@@ -428,7 +428,7 @@ impl Registration {
return Err(EINVAL);
}
- let mut fs = this.fs.get_mut();
+ let fs = this.fs.get_mut();
fs.owner = module.0;
fs.name = T::NAME.as_char_ptr();
fs.fs_flags = T::FLAGS;