[PATCH 1/4] of: Introduce of_property_read_s32_index()

Herve Codina
2026-03-30T10:16:22Z

Signed integers can be read from single value properties using
of_property_read_s32() but nothing exist to read signed integers
from multi-value properties.

Fix this lack adding of_property_read_s32_index().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
include/linux/of.h | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/include/linux/of.h b/include/linux/of.h
index be6ec4916adf..526c1ee819cd 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1457,6 +1457,13 @@ static inline int of_property_read_s32(const struct device_node *np,
return of_property_read_u32(np, propname, (u32*) out_value);
}

+static inline int of_property_read_s32_index(const struct device_node *np,
+ const char *propname, u32 index,
+ s32 *out_value)
+{
+ return of_property_read_u32_index(np, propname, index, (u32 *)out_value);
+}
+
#define of_for_each_phandle(it, err, np, ln, cn, cc) \
for (of_phandle_iterator_init((it), (np), (ln), (cn), (cc)), \
err = of_phandle_iterator_next(it); \
--
2.53.0