Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/samples/rust/rust_driver_faux.rs
26282 views
1
// SPDX-License-Identifier: GPL-2.0-only
2
3
//! Rust faux device sample.
4
5
use kernel::{c_str, faux, prelude::*, Module};
6
7
module! {
8
type: SampleModule,
9
name: "rust_faux_driver",
10
authors: ["Lyude Paul"],
11
description: "Rust faux device sample",
12
license: "GPL",
13
}
14
15
struct SampleModule {
16
_reg: faux::Registration,
17
}
18
19
impl 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
}
30
31