Skip to content

Commit 1fa10de

Browse files
authored
Merge pull request #184 from ojeda/improv
A few improvements
2 parents 8374974 + 4140620 commit 1fa10de

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15557,6 +15557,7 @@ W: https://github.com/Rust-for-Linux/linux
1555715557
B: https://github.com/Rust-for-Linux/linux/issues
1555815558
T: git https://github.com/Rust-for-Linux/linux.git rust-next
1555915559
F: rust/
15560+
F: samples/rust/
1556015561
F: Documentation/rust/
1556115562
K: \b(?i:rust)\b
1556215563

rust/Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3-
obj-$(CONFIG_RUST) += helpers.o exports.o
4-
obj-$(CONFIG_RUST) += core.o compiler_builtins.o alloc.o kernel.o
5-
extra-$(CONFIG_RUST) += bindings_generated.rs libmodule.so
6-
extra-$(CONFIG_RUST) += exports_core_generated.h exports_alloc_generated.h
7-
extra-$(CONFIG_RUST) += exports_kernel_generated.h
3+
obj-$(CONFIG_RUST) += core.o compiler_builtins.o helpers.o
4+
extra-$(CONFIG_RUST) += exports_core_generated.h
5+
6+
extra-$(CONFIG_RUST) += libmodule.so
7+
8+
extra-$(CONFIG_RUST) += bindings_generated.rs
9+
obj-$(CONFIG_RUST) += alloc.o kernel.o
10+
extra-$(CONFIG_RUST) += exports_alloc_generated.h exports_kernel_generated.h
11+
12+
obj-$(CONFIG_RUST) += exports.o
813

914
RUSTDOC = rustdoc
1015

rust/compiler_builtins.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,14 @@ define_panicking_intrinsics!("`u128` should not be used", {
133133
__udivti3,
134134
__umodti3,
135135
});
136+
137+
extern "C" {
138+
fn rust_helper_BUG() -> !;
139+
}
140+
141+
#[panic_handler]
142+
fn panic(_info: &core::panic::PanicInfo) -> ! {
143+
unsafe {
144+
rust_helper_BUG();
145+
}
146+
}

rust/kernel/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use core::fmt;
66

77
/// A pre-allocated buffer that implements [`core::fmt::Write`].
88
///
9-
/// Consequtive writes will append to what has already been written.
9+
/// Consecutive writes will append to what has already been written.
1010
/// Writes that don't fit in the buffer will fail.
1111
pub struct Buffer<'a> {
1212
slice: &'a mut [u8],

rust/kernel/lib.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#[cfg(not(CONFIG_RUST))]
3131
compile_error!("Missing kernel configuration for conditional compilation");
3232

33-
use core::panic::PanicInfo;
34-
3533
mod allocator;
3634

3735
#[doc(hidden)]
@@ -130,17 +128,6 @@ impl<'a> Drop for KParamGuard<'a> {
130128
}
131129
}
132130

133-
extern "C" {
134-
fn rust_helper_BUG() -> !;
135-
}
136-
137-
#[panic_handler]
138-
fn panic(_info: &PanicInfo) -> ! {
139-
unsafe {
140-
rust_helper_BUG();
141-
}
142-
}
143-
144131
/// Calculates the offset of a field from the beginning of the struct it belongs to.
145132
///
146133
/// # Example

0 commit comments

Comments
 (0)