Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Rust driver that touches real hardware: PR 2/6 #276

Merged
merged 3 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 0 additions & 156 deletions arch/arm/boot/dts/bcm2835-rpi-zero-w-rust.dts

This file was deleted.

135 changes: 0 additions & 135 deletions arch/arm/boot/dts/bcm2836-rpi-2-b-rust.dts

This file was deleted.

9 changes: 8 additions & 1 deletion drivers/char/hw_random/bcm2835_rng_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use alloc::boxed::Box;
use core::pin::Pin;
use kernel::of::OfMatchTable;
use kernel::prelude::*;
use kernel::{cstr, platdev};

Expand All @@ -24,7 +25,13 @@ struct RngModule {

impl KernelModule for RngModule {
fn init() -> Result<Self> {
let pdev = platdev::Registration::new_pinned(cstr!("bcm2835-rng-rust"), &THIS_MODULE)?;
let of_match_tbl = OfMatchTable::new(&cstr!("brcm,bcm2835-rng"))?;

let pdev = platdev::Registration::new_pinned(
cstr!("bcm2835-rng-rust"),
Some(of_match_tbl),
&THIS_MODULE,
)?;

Ok(RngModule { _pdev: pdev })
}
Expand Down
1 change: 1 addition & 0 deletions rust/kernel/bindings_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/mm.h>
#include <uapi/linux/android/binder.h>
#include <linux/platform_device.h>
#include <linux/of_platform.h>

// `bindgen` gets confused at certain things
const gfp_t BINDINGS_GFP_KERNEL = GFP_KERNEL;
Expand Down
1 change: 1 addition & 0 deletions rust/kernel/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub mod sysctl;

pub mod io_buffer;
pub mod iov_iter;
pub mod of;
pub mod platdev;
mod types;
pub mod user_ptr;
Expand Down
Loading