summaryrefslogtreecommitdiff
path: root/samples/rust
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2024-10-15 16:04:37 +0200
committerDanilo Krummrich <dakr@kernel.org>2024-10-22 20:00:40 +0200
commit201e3970b3ab058124c727a4d9b707ef8ff09de4 (patch)
tree45c091fd4231ffd9349cc19c1932c63e325d9e0d /samples/rust
parentc68f2dcb15df955adb567194785e056a55e5f9b0 (diff)
rust: pass module name to `Module::init`
In a subsequent patch we introduce the `Registration` abstraction used to register driver structures. Some subsystems require the module name on driver registration (e.g. PCI in __pci_register_driver()), hence pass the module name to `Module::init`. Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'samples/rust')
-rw-r--r--samples/rust/rust_minimal.rs2
-rw-r--r--samples/rust/rust_print.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/samples/rust/rust_minimal.rs b/samples/rust/rust_minimal.rs
index 4aaf117bf8e3..1577dc34e563 100644
--- a/samples/rust/rust_minimal.rs
+++ b/samples/rust/rust_minimal.rs
@@ -17,7 +17,7 @@ struct RustMinimal {
}
impl kernel::Module for RustMinimal {
- fn init(_module: &'static ThisModule) -> Result<Self> {
+ fn init(_name: &'static CStr, _module: &'static ThisModule) -> Result<Self> {
pr_info!("Rust minimal sample (init)\n");
pr_info!("Am I built-in? {}\n", !cfg!(MODULE));
diff --git a/samples/rust/rust_print.rs b/samples/rust/rust_print.rs
index ba1606bdbd75..73763ea2dc09 100644
--- a/samples/rust/rust_print.rs
+++ b/samples/rust/rust_print.rs
@@ -41,7 +41,7 @@ fn arc_print() -> Result {
}
impl kernel::Module for RustPrint {
- fn init(_module: &'static ThisModule) -> Result<Self> {
+ fn init(_name: &'static CStr, _module: &'static ThisModule) -> Result<Self> {
pr_info!("Rust printing macros sample (init)\n");
pr_emerg!("Emergency message (level 0) without args\n");