[U-Boot] [PATCH 1/3] fdt: Export fdtdec_get_number()

Thierry Reding thierry.reding at gmail.com
Fri Mar 20 12:51:46 CET 2015


From: Thierry Reding <treding at nvidia.com>

Drivers that need to parse addresses from the device tree will want to
reuse this function rather than duplicating it.

Cc: Simon Glass <sjg at chromium.org>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 include/fdtdec.h | 8 ++++++++
 lib/fdtdec.c     | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 5ac515d87d2d..5530ee407311 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -723,6 +723,14 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
 			   struct fmap_entry *entry);
 
 /**
+ * Read a number from a device property.
+ * @param ptr		pointer to the cells to read
+ * @param cells		number of cells to consume
+ * @return The number contained in @cells cells at @ptr, in host byte order.
+ */
+u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells);
+
+/**
  * Obtain an indexed resource from a device property.
  *
  * @param fdt		FDT blob
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 0776c3004cbd..613cc8494a74 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -918,7 +918,7 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name,
 	return 0;
 }
 
-static u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells)
+u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells)
 {
 	u64 number = 0;
 
-- 
2.3.2



More information about the U-Boot mailing list