Skip to content

Commit 5bcc52f

Browse files
committed
Put the test inside of another test
1 parent 41b3e58 commit 5bcc52f

File tree

8 files changed

+8
-64
lines changed

8 files changed

+8
-64
lines changed

.github/workflows/kernel-arm64-debug.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ CONFIG_RUST_EXAMPLE=y
766766
CONFIG_RUST_EXAMPLE_2=y
767767
CONFIG_RUST_EXAMPLE_3=m
768768
CONFIG_RUST_EXAMPLE_4=m
769-
CONFIG_RUST_EXAMPLE_5=m
770769
# end of Character devices
771770

772771
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set

.github/workflows/kernel-arm64-release.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,6 @@ CONFIG_RUST_EXAMPLE=y
758758
CONFIG_RUST_EXAMPLE_2=y
759759
CONFIG_RUST_EXAMPLE_3=m
760760
CONFIG_RUST_EXAMPLE_4=m
761-
CONFIG_RUST_EXAMPLE_5=m
762761
# end of Character devices
763762

764763
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set

.github/workflows/kernel-x86_64-debug.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ CONFIG_RUST_EXAMPLE=y
767767
CONFIG_RUST_EXAMPLE_2=y
768768
CONFIG_RUST_EXAMPLE_3=m
769769
CONFIG_RUST_EXAMPLE_4=m
770-
CONFIG_RUST_EXAMPLE_5=m
771770
# end of Character devices
772771

773772
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set

.github/workflows/kernel-x86_64-release.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,6 @@ CONFIG_RUST_EXAMPLE=y
820820
CONFIG_RUST_EXAMPLE_2=y
821821
CONFIG_RUST_EXAMPLE_3=m
822822
CONFIG_RUST_EXAMPLE_4=m
823-
CONFIG_RUST_EXAMPLE_5=m
824823
# end of Character devices
825824

826825
# CONFIG_RANDOM_TRUST_CPU is not set

drivers/char/Kconfig

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -525,20 +525,6 @@ config RUST_EXAMPLE_4
525525

526526
If unsure, say N.
527527

528-
# XXX: Only for GitHub -- do not commit into mainline
529-
config RUST_EXAMPLE_5
530-
depends on RUST
531-
tristate "Rust Example 5"
532-
default n
533-
help
534-
This option builds a fifth example module written in Rust.
535-
It is intended to test several Rust modules at the same time.
536-
537-
To compile this as a module, choose M here:
538-
the module will be called rust_example_5.
539-
540-
If unsure, say N.
541-
542528
endmenu
543529

544530
config RANDOM_TRUST_CPU

drivers/char/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ obj-$(CONFIG_RUST_EXAMPLE) += rust_example.o
5252
obj-$(CONFIG_RUST_EXAMPLE_2) += rust_example_2.o
5353
obj-$(CONFIG_RUST_EXAMPLE_3) += rust_example_3.o
5454
obj-$(CONFIG_RUST_EXAMPLE_4) += rust_example_4.o
55-
obj-$(CONFIG_RUST_EXAMPLE_5) += rust_example_5.o

drivers/char/rust_example.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use alloc::boxed::Box;
88
use core::pin::Pin;
99
use kernel::prelude::*;
10-
use kernel::{cstr, file_operations::FileOperations, miscdev};
10+
use kernel::{chrdev, cstr, file_operations::FileOperations, miscdev};
1111

1212
module! {
1313
type: RustExample,
@@ -47,6 +47,7 @@ impl FileOperations for RustFile {
4747

4848
struct RustExample {
4949
message: String,
50+
_chrdev: Pin<Box<chrdev::Registration<2>>>,
5051
_dev: Pin<Box<miscdev::Registration>>,
5152
}
5253

@@ -72,9 +73,15 @@ impl KernelModule for RustExample {
7273
let x: [u64; 1028] = core::hint::black_box([5; 1028]);
7374
println!("Large array has length: {}", x.len());
7475

76+
let mut chrdev_reg = chrdev::Registration::new_pinned(
77+
cstr!("rust_chrdev"), 0, &THIS_MODULE)?;
78+
chrdev_reg.as_mut().register::<RustFile>()?;
79+
chrdev_reg.as_mut().register::<RustFile>()?;
80+
7581
Ok(RustExample {
7682
message: "on the heap!".to_owned(),
7783
_dev: miscdev::Registration::new_pinned::<RustFile>(cstr!("rust_miscdev"), None)?,
84+
_chrdev: chrdev_reg,
7885
})
7986
}
8087
}

drivers/char/rust_example_5.rs

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)