aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-06-06 15:37:00 -0600
committerDavid Gibson <david@gibson.dropbear.id.au>2018-06-08 22:25:02 +1000
commitf0f8c9169819e5505e63e247e40e9593625e01a4 (patch)
tree7958ae5130f6ff5df1b95201b0a6c452ecb6fdb9
parent64a69d123935511f35da1a6101e32d4276f57cd3 (diff)
downloaddtc-f0f8c9169819e5505e63e247e40e9593625e01a4.zip
dtc-f0f8c9169819e5505e63e247e40e9593625e01a4.tar.gz
dtc-f0f8c9169819e5505e63e247e40e9593625e01a4.tar.bz2
pylibfdt: Reorder functions to match libfdt.h
The ordering of the Python functions loosely matches the corresponding function in the C header file, but not exactly. As we add more functions it is easier to track what is missing if they are in the same order. Move some functions around to achieve this. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--pylibfdt/libfdt.i144
1 files changed, 72 insertions, 72 deletions
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index 170005f..2ad9d33 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -185,6 +185,52 @@ class Fdt:
"""
return bytearray(self._fdt)
+ def first_subnode(self, nodeoffset, quiet=()):
+ """Find the first subnode of a parent node
+
+ Args:
+ nodeoffset: Node offset of parent node
+ quiet: Errors to ignore (empty to raise on all errors)
+
+ Returns:
+ The offset of the first subnode, if any
+
+ Raises:
+ FdtException if no subnodes found or other error occurs
+ """
+ return check_err(fdt_first_subnode(self._fdt, nodeoffset), quiet)
+
+ def next_subnode(self, nodeoffset, quiet=()):
+ """Find the next subnode
+
+ Args:
+ nodeoffset: Node offset of previous subnode
+ quiet: Errors to ignore (empty to raise on all errors)
+
+ Returns:
+ The offset of the next subnode, if any
+
+ Raises:
+ FdtException if no more subnodes found or other error occurs
+ """
+ return check_err(fdt_next_subnode(self._fdt, nodeoffset), quiet)
+
+ def totalsize(self):
+ """Return the total size of the device tree
+
+ Returns:
+ Total tree size in bytes
+ """
+ return check_err(fdt_totalsize(self._fdt))
+
+ def off_dt_struct(self):
+ """Return the start of the device tree struct area
+
+ Returns:
+ Start offset of struct area
+ """
+ return check_err(fdt_off_dt_struct(self._fdt))
+
def subnode_offset(self, parentoffset, name, quiet=()):
"""Get the offset of a named subnode
@@ -217,6 +263,20 @@ class Fdt:
"""
return check_err(fdt_path_offset(self._fdt, path), quiet)
+ def get_name(self, nodeoffset):
+ """Get the name of a node
+
+ Args:
+ nodeoffset: Offset of node to check
+
+ Returns:
+ Node name
+
+ Raises:
+ FdtException on error (e.g. nodeoffset is invalid)
+ """
+ return check_err_null(fdt_get_name(self._fdt, nodeoffset))[0]
+
def first_property_offset(self, nodeoffset, quiet=()):
"""Get the offset of the first property in a node offset
@@ -251,20 +311,6 @@ class Fdt:
return check_err(fdt_next_property_offset(self._fdt, prop_offset),
quiet)
- def get_name(self, nodeoffset):
- """Get the name of a node
-
- Args:
- nodeoffset: Offset of node to check
-
- Returns:
- Node name
-
- Raises:
- FdtException on error (e.g. nodeoffset is invalid)
- """
- return check_err_null(fdt_get_name(self._fdt, nodeoffset))[0]
-
def get_property_by_offset(self, prop_offset, quiet=()):
"""Obtains a property that can be examined
@@ -285,52 +331,6 @@ class Fdt:
return pdata
return Property(pdata[0], pdata[1])
- def first_subnode(self, nodeoffset, quiet=()):
- """Find the first subnode of a parent node
-
- Args:
- nodeoffset: Node offset of parent node
- quiet: Errors to ignore (empty to raise on all errors)
-
- Returns:
- The offset of the first subnode, if any
-
- Raises:
- FdtException if no subnode found or other error occurs
- """
- return check_err(fdt_first_subnode(self._fdt, nodeoffset), quiet)
-
- def next_subnode(self, nodeoffset, quiet=()):
- """Find the next subnode
-
- Args:
- nodeoffset: Node offset of previous subnode
- quiet: Errors to ignore (empty to raise on all errors)
-
- Returns:
- The offset of the next subnode, if any
-
- Raises:
- FdtException if no more subnode found or other error occurs
- """
- return check_err(fdt_next_subnode(self._fdt, nodeoffset), quiet)
-
- def totalsize(self):
- """Return the total size of the device tree
-
- Returns:
- Total tree size in bytes
- """
- return check_err(fdt_totalsize(self._fdt))
-
- def off_dt_struct(self):
- """Return the start of the device tree struct area
-
- Returns:
- Start offset of struct area
- """
- return check_err(fdt_off_dt_struct(self._fdt))
-
def pack(self, quiet=()):
"""Pack the device tree to remove unused space
@@ -344,18 +344,6 @@ class Fdt:
"""
return check_err(fdt_pack(self._fdt), quiet)
- def delprop(self, nodeoffset, prop_name):
- """Delete a property from a node
-
- Args:
- nodeoffset: Node offset containing property to delete
- prop_name: Name of property to delete
-
- Raises:
- FdtError if the property does not exist, or another error occurs
- """
- return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name))
-
def getprop(self, nodeoffset, prop_name, quiet=()):
"""Get a property from a node
@@ -404,6 +392,18 @@ class Fdt:
"""
return check_err(fdt_parent_offset(self._fdt, nodeoffset), quiet)
+ def delprop(self, nodeoffset, prop_name):
+ """Delete a property from a node
+
+ Args:
+ nodeoffset: Node offset containing property to delete
+ prop_name: Name of property to delete
+
+ Raises:
+ FdtError if the property does not exist, or another error occurs
+ """
+ return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name))
+
def node_offset_by_phandle(self, phandle, quiet=()):
"""Get the offset of a node with the given phandle