mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-03-03 18:28:01 +01:00
This is now handled by the macro itself. Signed-off-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260123175854.176735-3-gary@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
34 lines
670 B
Rust
34 lines
670 B
Rust
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
//! Rust faux device sample.
|
|
|
|
use kernel::{
|
|
faux,
|
|
prelude::*,
|
|
Module, //
|
|
};
|
|
|
|
module! {
|
|
type: SampleModule,
|
|
name: "rust_faux_driver",
|
|
authors: ["Lyude Paul"],
|
|
description: "Rust faux device sample",
|
|
license: "GPL",
|
|
}
|
|
|
|
struct SampleModule {
|
|
_reg: faux::Registration,
|
|
}
|
|
|
|
impl Module for SampleModule {
|
|
fn init(_module: &'static ThisModule) -> Result<Self> {
|
|
pr_info!("Initialising Rust Faux Device Sample\n");
|
|
|
|
let reg = faux::Registration::new(c"rust-faux-sample-device", None)?;
|
|
|
|
dev_info!(reg, "Hello from faux device!\n");
|
|
|
|
Ok(Self { _reg: reg })
|
|
}
|
|
}
|