[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220325113148.588163-2-clement.leger@bootlin.com>
Date: Fri, 25 Mar 2022 12:31:40 +0100
From: Clément Léger <clement.leger@...tlin.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Wolfram Sang <wsa@...nel.org>, Peter Rosin <peda@...ntia.se>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Len Brown <lenb@...nel.org>
Cc: Hans de Goede <hdegoede@...hat.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Allan Nielsen <allan.nielsen@...rochip.com>,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-i2c@...r.kernel.org, devicetree@...r.kernel.org,
Clément Léger <clement.leger@...tlin.com>
Subject: [PATCH v3 1/9] of: add of_property_read_string_array_index()
Add of_property_read_string_array_index() which allows to read a string
array starting at a specific index.
Signed-off-by: Clément Léger <clement.leger@...tlin.com>
---
include/linux/of.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/include/linux/of.h b/include/linux/of.h
index 2dc77430a91a..93f04c530bd1 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1115,6 +1115,28 @@ static inline int of_property_read_string_array(const struct device_node *np,
return of_property_read_string_helper(np, propname, out_strs, sz, 0);
}
+/**
+ * of_property_read_string_array_index() - Read an array of strings from a
+ * multiple strings property starting at a specified index
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
+ * @out_strs: output array of string pointers.
+ * @sz: number of array elements to read.
+ * @index: index to start reading from
+ *
+ * Search for a property in a device tree node and retrieve a list of
+ * terminated string values (pointer to data, not a copy) in that property
+ * starting at specified index.
+ *
+ * Return: If @out_strs is NULL, the number of strings in the property is returned.
+ */
+static inline int of_property_read_string_array_index(const struct device_node *np,
+ const char *propname,
+ const char **out_strs,
+ size_t sz, int index)
+{
+ return of_property_read_string_helper(np, propname, out_strs, sz, index);
+}
/**
* of_property_count_strings() - Find and return the number of strings from a
* multiple strings property.
--
2.34.1
Powered by blists - more mailing lists