Re: [PATCH 01/10] pylibfdt: Reorder functions to match libfdt.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, May 23, 2018 at 10:03:37PM -0600, Simon Glass wrote:
> 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@xxxxxxxxxxxx>

This didn't apply clean for me, probably because I don't have all of
your earlier patches applied.  This is a situation where putting a
cover letter on the series saying exactly what tree it applies against
would be useful.

> ---
> 
>  pylibfdt/libfdt.i | 145 +++++++++++++++++++++++-----------------------
>  1 file changed, 73 insertions(+), 72 deletions(-)
> 
> diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
> index 328d440..17e09d7 100644
> --- a/pylibfdt/libfdt.i
> +++ b/pylibfdt/libfdt.i
> @@ -153,6 +153,7 @@ def check_err_null(val, quiet=()):
>              raise FdtException(val)
>      return val
>  
> +
>  class Fdt:
>      """Device tree class, supporting all operations
>  
> @@ -185,6 +186,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 +264,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 +312,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 +332,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 +345,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
>  
> @@ -423,6 +412,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
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux