FwNode in kernel::device::property - Rust
Skip to main content FwNode kernel :: device :: property Struct FwNode Source pub struct FwNode( /* private fields */ ); Expand description A reference-counted fwnode_handle. This structure represents the Rust abstraction for a C struct fwnode_handle . This implementation abstracts the usage of an already existing C struct fwnode_handle within Rust code that we get passed from the C side. § Invariants A FwNode instance represents a valid struct fwnode_handle created by the C portion of the kernel.
Instances of this type are always reference-counted, that is, a call to fwnode_handle_get ensures that the allocation remains valid at least until the matching call to fwnode_handle_put . Implementations § Source § impl FwNode Source pub fn is_of_node (&self) -> bool Returns true if &self is an OF node, false otherwise. Source pub fn display_name (&self) -> impl Display + '_ Returns an object that implements Display for printing the name of a node.
This is an alternative to the default Display implementation, which prints the full path. Source pub fn property_present (&self, name: & CStr ) -> bool Checks if property is present or not. Source pub fn property_read_bool (&self, name: & CStr ) -> bool Returns firmware property name boolean value. Source pub fn property_match_string ( &self, name: & CStr , match_str: & CStr , ) -> Result < usize > Returns the index of matching string match_str for firmware string property name .
Source pub fn property_read_array_vec <'fwnode, 'name, T: PropertyInt >( &'fwnode self, name: &'name CStr , len: usize , ) -> Result < PropertyGuard <'fwnode, 'name, KVec <T>>> Returns firmware property name integer array values in a KVec . Source pub fn property_count_elem <T: PropertyInt >(&self, name: & CStr ) -> Result < usize > Returns integer array length for firmware property name . Source pub fn property_read <'fwnode, 'name, T: Property >( &'fwnode self, name: &'name CStr , ) -> PropertyGuard <'fwnode, 'name, T> Returns the value of firmware property name .
This method is generic over the type of value to read. The types that can be read are strings, integers and arrays of integers. Reading a KVec of integers is done with the separate method Self::property_read_array_vec , because it takes an additional len argument. Reading a boolean is done with the separate method Self::property_read_bool , because this operation is infallible. For more precise documentation about what types can be read, see the implementors of Property and its implementations on foreign types . § Examples fn examples(dev: & Device) -> Result { let fwnode = dev.fwnode().ok_or(ENOENT) ? ; let b: u32 = fwnode.property_read( c"some-number" ).required_by(dev) ? ; if let Some (s) = fwnode.property_read::<CString>( c"some-str" ).optional() { // ... } Ok (()) } Source pub fn get_child_by_name (&self, name: & CStr ) -> Option < ARef <Self>> Returns first matching named child node handle.
Source pub fn children <'a>(&'a self) -> impl Iterator <Item = ARef < FwNode >> + 'a Returns an iterator over a node’s children. Source pub fn property_get_reference_args ( &self, prop: & CStr , nargs: NArgs <'_>, index: u32 , ) -> Result < FwNodeReferenceArgs > Finds a reference with arguments. Trait Implementations § Source § impl AlwaysRefCounted for FwNode Source § fn inc_ref (&self) Increments the reference count on the object.
Source § unsafe fn dec_ref (obj: NonNull <Self>) Decrements the reference count on the object. Read more Source § impl Display for FwNode Source § fn fmt (&self, f: &mut Formatter <'_>) -> Result Same as core::fmt::Display::fmt . Auto Trait Implementations § § impl ! Freeze for FwNode § impl ! RefUnwindSafe for FwNode § impl ! Send for FwNode § impl ! Sync for FwNode § impl ! Unpin for FwNode § impl ! UnsafeUnpin for FwNode § impl UnwindSafe for FwNode Blanket Implementations § Source § impl<T> Any for T where T: 'static + ?
Sized , Source § fn type_id (&self) -> TypeId Gets the TypeId of self . Read more Source § impl<T> Borrow <T> for T where T: ? Sized , Source § fn borrow (&self) -> &T Immutably borrows from an owned value. Read more Source § impl<T> BorrowMut <T> for T where T: ? Sized , Source § fn borrow_mut (&mut self) -> &mut T Mutably borrows from an owned value. Read more Source § impl<ST, DT> CastableFrom <ST, Initialized , Initialized > for DT where ST: ?
Sized , DT: ? Sized , Source § impl<ST, DT> CastableFrom <ST, Uninit , Uninit > for DT where ST: ? Sized , DT: ? Sized , Source § impl<T> From <T> for T Source § fn from (t: T) -> T Returns the argument unchanged. Source § impl<T> Init <T> for T Source § fn chain <F>(self, f: F) -> ChainInit <Self, F, T, E> where F: FnOnce ( &mut T ) -> Result < () , E>, First initializes the value using self then calls the function f with the initialized value.
Read more Source § impl<T, U> Into <U> for T where U: From <T>, Source § fn into (self) -> U Calls U::from(self) . That is, this conversion is whatever the implementation of From <T> for U chooses to do. Source § impl<S, T> IntoSafeCast <T> for S where T: FromSafeCast <S>, Source § fn into_safe_cast (self) -> T Convert self into a T . This operation is guaranteed to be lossless. Source § impl<S, T> IntoSafeCastArch <T> for S where T: FromSafeCastArch <S>, Source § fn into_safe_cast_arch (self) -> T Convert self into a T .
This operation is guaranteed to be lossless. Source § impl<T> KnownSize for T Source § const MIN_SIZE : usize = const MIN_SIZE: usize = size_of::<T>(); Minimum size of this type known at compile-time. Source § const MIN_ALIGN : Alignment = const MIN_ALIGN: Alignment = Alignment::of::<T>(); Minimum alignment of this type known at compile-time. Source § fn size (_: *const T ) -> usize Get the size of an object of this type in bytes, with the metadata of the given pointer.
Source § impl<T> PinInit <T> for T Source § unsafe fn __init (self, slot: *mut T ) -> Result < () , ! > Initializes slot . Read more Source § fn pin_chain <F>(self, f: F) -> ChainPinInit <Self, F, T, E> where F: FnOnce ( Pin < &mut T >) -> Result < () , E>, First initializes the value using self then calls the function f with the initialized value. Read more Source § impl<T> Read < Exclusive , BecauseExclusive > for T where T: ?
Sized , Source § impl<T, U> TryFrom <U> for T where U: Into <T>, Source § type Error = ! The type returned in the event of a conversion error. Source § fn try_from (value: U) -> Result <T, ! > Performs the conversion. Source § impl<T, U> TryInto <U> for T where U: TryFrom <T>, Source § type Error = <U as TryFrom <T>>:: Error The type returned in the event of a conversion error. Source § fn try_into (self) -> Result <U, <U as TryFrom <T>>:: Error > Performs the conversion.
Source § impl<T, U, const N: u32 > TryIntoBounded <T, N> for U where T: Integer , U: TryInto <T>, Source § fn try_into_bounded (self) -> Option < Bounded <T, N>> Attempts to convert self into a Bounded using N bits. Read more