Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rust: samples: add a module parameter to the rust_minimal sample

Showcase the rust module parameter support by adding a module parameter to
the `rust_minimal` sample.

Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Tested-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Daniel Gomez <da.gomez@kernel.org>

authored by

Andreas Hindborg and committed by
Daniel Gomez
e119c2fe 0b24f974

+10
+10
samples/rust/rust_minimal.rs
··· 10 10 authors: ["Rust for Linux Contributors"], 11 11 description: "Rust minimal sample", 12 12 license: "GPL", 13 + params: { 14 + test_parameter: i64 { 15 + default: 1, 16 + description: "This parameter has a default of 1", 17 + }, 18 + }, 13 19 } 14 20 15 21 struct RustMinimal { ··· 26 20 fn init(_module: &'static ThisModule) -> Result<Self> { 27 21 pr_info!("Rust minimal sample (init)\n"); 28 22 pr_info!("Am I built-in? {}\n", !cfg!(MODULE)); 23 + pr_info!( 24 + "test_parameter: {}\n", 25 + *module_parameters::test_parameter.value() 26 + ); 29 27 30 28 let mut numbers = KVec::new(); 31 29 numbers.push(72, GFP_KERNEL)?;