Skip to content

Commit 3b438d9

Browse files
committed
rust: Fix x86 build more
Signed-off-by: Hector Martin <[email protected]>
1 parent 0eab828 commit 3b438d9

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

rust/kernel/of.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,21 +500,41 @@ where
500500

501501
/// Returns the root node of the OF device tree (if any).
502502
pub fn root() -> Option<Node> {
503+
#[cfg(not(CONFIG_OF))]
504+
{
505+
None
506+
}
507+
#[cfg(CONFIG_OF)]
503508
unsafe { Node::get_from_raw(bindings::of_root) }
504509
}
505510

506511
/// Returns the /chosen node of the OF device tree (if any).
507512
pub fn chosen() -> Option<Node> {
513+
#[cfg(not(CONFIG_OF))]
514+
{
515+
None
516+
}
517+
#[cfg(CONFIG_OF)]
508518
unsafe { Node::get_from_raw(bindings::of_chosen) }
509519
}
510520

511521
/// Returns the /aliases node of the OF device tree (if any).
512522
pub fn aliases() -> Option<Node> {
523+
#[cfg(not(CONFIG_OF))]
524+
{
525+
None
526+
}
527+
#[cfg(CONFIG_OF)]
513528
unsafe { Node::get_from_raw(bindings::of_aliases) }
514529
}
515530

516531
/// Returns the system stdout node of the OF device tree (if any).
517532
pub fn stdout() -> Option<Node> {
533+
#[cfg(not(CONFIG_OF))]
534+
{
535+
None
536+
}
537+
#[cfg(CONFIG_OF)]
518538
unsafe { Node::get_from_raw(bindings::of_stdout) }
519539
}
520540

0 commit comments

Comments
 (0)