diff mbox series

[6/9] dm: Provide dev_read_addr_index_ptr() wrapper

Message ID 20210912031516.24885-6-bmeng.cn@gmail.com
State Accepted
Commit bdce903106397add4283b713132e24972a6ac0ee
Delegated to: Andes
Headers show
Series [1/9] cache: sifive: Fix -Wint-to-pointer-cast warning | expand

Commit Message

Bin Meng Sept. 12, 2021, 3:15 a.m. UTC
Like dev_read_addr_ptr(), provide a wrapper for the indexed version.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 include/dm/read.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Leo Liang Sept. 15, 2021, 7:23 a.m. UTC | #1
On Sun, Sep 12, 2021 at 11:15:13AM +0800, Bin Meng wrote:
> Like dev_read_addr_ptr(), provide a wrapper for the indexed version.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  include/dm/read.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Simon Glass Sept. 30, 2021, 4:09 a.m. UTC | #2
On Sat, 11 Sept 2021 at 21:15, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Like dev_read_addr_ptr(), provide a wrapper for the indexed version.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  include/dm/read.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>

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

Patch

diff --git a/include/dm/read.h b/include/dm/read.h
index 5bf3405614..890bf3d847 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -180,6 +180,18 @@  int dev_read_size(const struct udevice *dev, const char *propname);
  */
 fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index);
 
+/**
+ * dev_read_addr_index_ptr() - Get the indexed reg property of a device
+ *                             as a pointer
+ *
+ * @dev: Device to read from
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ *	   and @index is used to select which one is required
+ *
+ * @return pointer or NULL if not found
+ */
+void *dev_read_addr_index_ptr(const struct udevice *dev, int index);
+
 /**
  * dev_read_addr_size_index() - Get the indexed reg property of a device
  *
@@ -805,6 +817,12 @@  static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev,
 	return devfdt_get_addr_index(dev, index);
 }
 
+static inline void *dev_read_addr_index_ptr(const struct udevice *dev,
+					    int index)
+{
+	return devfdt_get_addr_index_ptr(dev, index);
+}
+
 static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev,
 						  int index,
 						  fdt_size_t *size)