libfdt: Remove duplicate FdtNode::from_mut()
The method duplicates FdtNodeMut::as_node() so remove it. Even if it's
pub, the only user seems to have been in pvmfw so replace it.
Test: m pvmfw
Test: atest liblibfdt.integration_test
Change-Id: I714a95d9a2c947e91f7bb5c86564ee13af898cbb
diff --git a/libs/libfdt/src/lib.rs b/libs/libfdt/src/lib.rs
index 39749f0..c61876d 100644
--- a/libs/libfdt/src/lib.rs
+++ b/libs/libfdt/src/lib.rs
@@ -276,10 +276,6 @@
}
impl<'a> FdtNode<'a> {
- /// Creates immutable node from a mutable node at the same offset.
- pub fn from_mut(other: &'a FdtNodeMut) -> Self {
- FdtNode { fdt: other.fdt, offset: other.offset }
- }
/// Returns parent node.
pub fn parent(&self) -> Result<Self> {
// SAFETY: Accesses (read-only) are constrained to the DT totalsize.
diff --git a/pvmfw/src/fdt.rs b/pvmfw/src/fdt.rs
index e83fe5a..1e37572 100644
--- a/pvmfw/src/fdt.rs
+++ b/pvmfw/src/fdt.rs
@@ -35,7 +35,6 @@
use libfdt::CellIterator;
use libfdt::Fdt;
use libfdt::FdtError;
-use libfdt::FdtNode;
use libfdt::FdtNodeMut;
use log::debug;
use log::error;
@@ -499,11 +498,8 @@
let name = cstr!("ns16550a");
let mut next = fdt.root_mut()?.next_compatible(name);
while let Some(current) = next? {
- let reg = FdtNode::from_mut(¤t)
- .reg()?
- .ok_or(FdtError::NotFound)?
- .next()
- .ok_or(FdtError::NotFound)?;
+ let reg =
+ current.as_node().reg()?.ok_or(FdtError::NotFound)?.next().ok_or(FdtError::NotFound)?;
next = if !serial_info.addrs.contains(®.addr) {
current.delete_and_next_compatible(name)
} else {