forked from thesofproject/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add minimal platform driver for bcm2835-rng
Implements the bare minimum for a platform driver to register itself with the core. It won't be able to do anything, except show up in sysfs. Signed-off-by: Sven Van Asbroeck <thesven73@gmail.com>
- Loading branch information
Sven Van Asbroeck
committed
May 18, 2021
1 parent
af25e4e
commit b136c6a
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
|
||
//! Broadcom BCM2835 Random Number Generator support. | ||
#![no_std] | ||
#![feature(allocator_api, global_asm)] | ||
|
||
use alloc::boxed::Box; | ||
use core::pin::Pin; | ||
use kernel::prelude::*; | ||
use kernel::{cstr, platdev}; | ||
|
||
module! { | ||
type: RngModule, | ||
name: b"bcm2835_rng_rust", | ||
author: b"Rust for Linux Contributors", | ||
description: b"BCM2835 Random Number Generator (RNG) driver", | ||
license: b"GPL v2", | ||
} | ||
|
||
struct RngModule { | ||
_pdev: Pin<Box<platdev::Registration>>, | ||
} | ||
|
||
impl KernelModule for RngModule { | ||
fn init() -> Result<Self> { | ||
let pdev = platdev::Registration::new_pinned(cstr!("bcm2835-rng-rust"), &THIS_MODULE)?; | ||
|
||
Ok(RngModule { _pdev: pdev }) | ||
} | ||
} |