36 lines
748 B
Rust
36 lines
748 B
Rust
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
use kernel::prelude::*;
|
|
|
|
module! {
|
|
type: Cider,
|
|
name: "cider",
|
|
author: "Snoweuph",
|
|
description: "An Macbook Pro Touchbar Driver",
|
|
license: "GPL",
|
|
}
|
|
|
|
struct Cider {
|
|
numbers: KVec<i32>,
|
|
}
|
|
|
|
impl kernel::Module for Cider {
|
|
fn init(_module: &'static ThisModule) -> Result<Self> {
|
|
pr_info!("cider (init)\n");
|
|
|
|
let mut numbers = KVec::new();
|
|
numbers.push(72, GFP_KERNEL)?;
|
|
numbers.push(108, GFP_KERNEL)?;
|
|
numbers.push(200, GFP_KERNEL)?;
|
|
|
|
Ok(RustOutOfTree { numbers })
|
|
}
|
|
}
|
|
|
|
impl Drop for Cider {
|
|
fn drop(&mut self) {
|
|
pr_info!("My numbers are {:?}\n", self.numbers);
|
|
pr_info!("cider sample (exit)\n");
|
|
}
|
|
}
|
|
|