File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626#include <linux/lockdep.h>
2727#include <linux/mdio.h>
2828#include <linux/miscdevice.h>
29+ #include <linux/of.h>
30+ #include <linux/of_address.h>
2931#include <linux/of_device.h>
3032#include <linux/pci.h>
3133#include <linux/phy.h>
Original file line number Diff line number Diff line change 2121#include "kunit.c"
2222#include "lockdep.c"
2323#include "mutex.c"
24+ #include "of.c"
2425#include "page.c"
2526#include "platform.c"
2627#include "pci.c"
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: GPL-2.0
2+
3+ #include <linux/of.h>
4+ #include <linux/of_device.h>
5+
6+ const struct of_device_id * rust_helper_of_match_device (
7+ const struct of_device_id * matches , const struct device * dev )
8+ {
9+ return of_match_device (matches , dev );
10+ }
11+ bool rust_helper_of_node_is_root (const struct device_node * np )
12+ {
13+ return of_node_is_root (np );
14+ }
15+
16+ struct device_node * rust_helper_of_parse_phandle (const struct device_node * np ,
17+ const char * phandle_name ,
18+ int index )
19+ {
20+ return of_parse_phandle (np , phandle_name , index );
21+ }
Original file line number Diff line number Diff line change 55//! C header: [`include/linux/device.h`](srctree/include/linux/device.h)
66
77use crate :: {
8- bindings,
8+ bindings, of ,
99 str:: CStr ,
1010 types:: { ARef , Opaque } ,
1111} ;
@@ -89,6 +89,13 @@ impl Device {
8989 unsafe { & * ptr. cast ( ) }
9090 }
9191
92+ /// Gets the OpenFirmware node attached to this device
93+ pub fn of_node ( & self ) -> Option < of:: Node > {
94+ let ptr = self . 0 . get ( ) ;
95+ // SAFETY: This is safe as long as of_node is NULL or valid.
96+ unsafe { of:: Node :: get_from_raw ( ( * ptr) . of_node ) }
97+ }
98+
9299 /// Prints an emergency-level message (level 0) prefixed with device information.
93100 ///
94101 /// More details are available from [`dev_emerg`].
You can’t perform that action at this time.
0 commit comments