| 1 | |
| 2 |
|
| 3 | |
| 4 |
|
| 5 | use kernel::{
|
| 6 | faux,
|
| 7 | prelude::*,
|
| 8 | Module, |
| 9 | };
|
| 10 |
|
| 11 | module! {
|
| 12 | type: SampleModule,
|
| 13 | name: "rust_faux_driver",
|
| 14 | authors: ["Lyude Paul"],
|
| 15 | description: "Rust faux device sample",
|
| 16 | license: "GPL",
|
| 17 | }
|
| 18 |
|
| 19 | struct SampleModule {
|
| 20 | _reg: faux::Registration,
|
| 21 | }
|
| 22 |
|
| 23 | impl Module for SampleModule {
|
| 24 | fn init(_module: &'static ThisModule) -> Result<Self> {
|
| 25 | pr_info!("Initialising Rust Faux Device Sample\n");
|
| 26 |
|
| 27 | let reg = faux::Registration::new(c"rust-faux-sample-device", None)?;
|
| 28 | let fdev = reg.as_ref();
|
| 29 |
|
| 30 | dev_info!(fdev, "Hello from faux device!\n");
|
| 31 |
|
| 32 | Ok(Self { _reg: reg })
|
| 33 | }
|
| 34 | }
|