Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0-only
2
3//! Rust faux device sample.
4
5use kernel::{c_str, faux, prelude::*, Module};
6
7module! {
8 type: SampleModule,
9 name: "rust_faux_driver",
10 authors: ["Lyude Paul"],
11 description: "Rust faux device sample",
12 license: "GPL",
13}
14
15struct SampleModule {
16 _reg: faux::Registration,
17}
18
19impl Module for SampleModule {
20 fn init(_module: &'static ThisModule) -> Result<Self> {
21 pr_info!("Initialising Rust Faux Device Sample\n");
22
23 let reg = faux::Registration::new(c_str!("rust-faux-sample-device"), None)?;
24
25 dev_info!(reg.as_ref(), "Hello from faux device!\n");
26
27 Ok(Self { _reg: reg })
28 }
29}