aboutsummaryrefslogtreecommitdiff
path: root/samples/rust/rust_platform.rs
blob: f62784676919da1232a805be5695af3d2a6c9621 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// SPDX-License-Identifier: GPL-2.0

//! Rust platform device driver sample.

use kernel::{module_platform_driver, of, platform, prelude::*};

module_platform_driver! {
    type: Driver,
    name: b"rust_platform",
    license: b"GPL",
}

struct Driver;
impl platform::Driver for Driver {
    kernel::define_of_id_table! {(), [
        (of::DeviceId::Compatible(b"rust,sample"), None),
    ]}

    fn probe(_dev: &mut platform::Device, _id_info: Option<&Self::IdInfo>) -> Result {
        Ok(())
    }
}