diff options
| author | Alexey Charkov <[email protected]> | 2026-08-24 17:13:11 +0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-08-31 17:06:21 -0600 |
| commit | 34fddfa16d47bd97f5b11d6b36dcbda91037e02f (patch) | |
| tree | bc00f7aec43e71ada4a546212be3989e02a2bc42 | |
| parent | f3e00d4b7f365929e18395194049d569d2288f31 (diff) | |
pylibfdt: Add address_cells() and size_cells()
Finding out how many cells a node's children use for addresses and sizes
currently requires calling the raw fdt_address_cells()/fdt_size_cells()
wrappers with the private FdtRo._fdt buffer, as the class exposes no
methods for them.
Add them to FdtRo alongside the other node accessors.
This is a backport of dtc commit 3750493c8b0f ("pylibfdt: Add
address_cells() and size_cells()").
Link: https://github.com/dgibson/dtc/pull/190
Signed-off-by: David Gibson <[email protected]>
Signed-off-by: Alexey Charkov <[email protected]>
| -rw-r--r-- | scripts/dtc/pylibfdt/libfdt.i_shipped | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped index c00e74a46b7..1983ebaee33 100644 --- a/scripts/dtc/pylibfdt/libfdt.i_shipped +++ b/scripts/dtc/pylibfdt/libfdt.i_shipped @@ -306,6 +306,38 @@ class FdtRo(object): check_err(val[0], quiet) return val[1:] + def address_cells(self, nodeoffset, quiet=()): + """Return the number of address cells used by a node's children + + Args: + nodeoffset: Offset of the node to check + quiet: Errors to ignore (empty to raise on all errors) + + Returns: + Number of address cells used by the children of @nodeoffset + + Raises: + FdtException if the node has an invalid #address-cells property, + or another error occurs + """ + return check_err(fdt_address_cells(self._fdt, nodeoffset), quiet) + + def size_cells(self, nodeoffset, quiet=()): + """Return the number of size cells used by a node's children + + Args: + nodeoffset: Offset of the node to check + quiet: Errors to ignore (empty to raise on all errors) + + Returns: + Number of size cells used by the children of @nodeoffset + + Raises: + FdtException if the node has an invalid #size-cells property, or + another error occurs + """ + return check_err(fdt_size_cells(self._fdt, nodeoffset), quiet) + def subnode_offset(self, parentoffset, name, quiet=()): """Get the offset of a named subnode |
