summaryrefslogtreecommitdiff
path: root/samples/rust/rust_pci_driver/mod.rs
blob: 9685bd6d2cde6447c28d7d7e94740db5e4a22ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: GPL-2.0

//! Rust PCI driver sample.

mod driver;

use kernel::{pci, prelude::*};

module! {
    type: Module,
    name: "rust_pci_driver_sample",
    author: "Danilo Krummrich",
    description: "Rust PCI driver sample",
    license: "GPL",
}

#[pin_data]
struct Module {
    #[pin]
    _reg: kernel::driver::Registration<pci::Adapter<driver::Driver>>,
}

impl kernel::InPlaceModule for Module {
    fn init(name: &'static CStr, module: &'static ThisModule) -> impl PinInit<Self, Error> {
        try_pin_init!(Module {
            _reg <- kernel::driver::Registration::new(name, module),
        })
    }
}