diff mbox series

[v2,1/2] dm: core: Add size operations on device tree references

Message ID 20210402062821.38162-2-chenguanqiao@kuaishou.com
State Superseded
Delegated to: Simon Glass
Headers show
Series dm: core: Add size operations on device tree references | expand

Commit Message

chenguanqiao April 2, 2021, 6:28 a.m. UTC
Add functions to add size of addresses in the device tree using ofnode
references.

Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
---
 drivers/core/ofnode.c |  9 +++++++++
 include/dm/ofnode.h   | 10 ++++++++++
 2 files changed, 19 insertions(+)

Comments

Simon Glass April 11, 2021, 6:48 p.m. UTC | #1
On Fri, 2 Apr 2021 at 19:30, chenguanqiao <chenguanqiao@kuaishou.com> wrote:
>
> Add functions to add size of addresses in the device tree using ofnode
> references.
>
> Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
> ---
>  drivers/core/ofnode.c |  9 +++++++++
>  include/dm/ofnode.h   | 10 ++++++++++
>  2 files changed, 19 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
> index fa0bd2a9c4..952c3cf9dd 100644
> --- a/drivers/core/ofnode.c
> +++ b/drivers/core/ofnode.c
> @@ -347,6 +347,15 @@ fdt_addr_t ofnode_get_addr(ofnode node)
>         return ofnode_get_addr_index(node, 0);
>  }
>
> +fdt_size_t ofnode_get_size(ofnode node)
> +{
> +       fdt_size_t size;
> +
> +       ofnode_get_addr_size_index(node, 0, &size);

size is not set if this function returns an error, so in that can you
need to return something


> +
> +       return size;
> +}
> +
>  int ofnode_stringlist_search(ofnode node, const char *property,
>                              const char *string)
>  {
> diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
> index 2c0597c407..e91f81282b 100644
> --- a/include/dm/ofnode.h
> +++ b/include/dm/ofnode.h
> @@ -510,6 +510,16 @@ phys_addr_t ofnode_get_addr_index(ofnode node, int index);
>   */
>  phys_addr_t ofnode_get_addr(ofnode node);
>
> +/**
> + * ofnode_get_size() - get size from a node
> + *
> + * This reads the register size from a node
> + *
> + * @node: node to read from
> + * @return size of the address
> + */
> +fdt_size_t ofnode_get_size(ofnode node);
> +
>  /**
>   * ofnode_stringlist_search() - find a string in a string list and return index
>   *
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index fa0bd2a9c4..952c3cf9dd 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -347,6 +347,15 @@  fdt_addr_t ofnode_get_addr(ofnode node)
 	return ofnode_get_addr_index(node, 0);
 }
 
+fdt_size_t ofnode_get_size(ofnode node)
+{
+	fdt_size_t size;
+
+	ofnode_get_addr_size_index(node, 0, &size);
+
+	return size;
+}
+
 int ofnode_stringlist_search(ofnode node, const char *property,
 			     const char *string)
 {
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 2c0597c407..e91f81282b 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -510,6 +510,16 @@  phys_addr_t ofnode_get_addr_index(ofnode node, int index);
  */
 phys_addr_t ofnode_get_addr(ofnode node);
 
+/**
+ * ofnode_get_size() - get size from a node
+ *
+ * This reads the register size from a node
+ *
+ * @node: node to read from
+ * @return size of the address
+ */
+fdt_size_t ofnode_get_size(ofnode node);
+
 /**
  * ofnode_stringlist_search() - find a string in a string list and return index
  *