Skip to contentSkip to conversation

devicetree: Document of_property_read_string_array() better

PATCH In review Sakari Ailus 2 participants 2 messages Feb 28, 2017 – Mar 2, 2017 1 message not in the archive Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devicetree: Document of_property_read_string_array() better

of_property_read_string_array() is documented to return the number of strings present in a string array property if its target string buffer is NULL. What is not documented, however, is that is returned if the buffer is non-NULL. It returns the number of strings read. Document this, as well as the error codes.

---
 include/linux/of.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/of.h +5 -1
index d72f010..5856765 100644
@@ -952,7 +952,11 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
  * 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.
  *
- * If @out_strs is NULL, the number of strings in the property is returned.
+ * If @out_strs is NULL, the number of strings in the property is returned. If
+ * $out_strs is non-NULL, returns the number of strings read. On error, the
+ * function returns -EINVAL if the property does not exist, -ENODATA if
+ * property does not have a value, and -EILSEQ if the string is not
+ * null-terminated within the length of the property data.
  */
 static inline int of_property_read_string_array(const struct device_node *np,
 						const char *propname, const char **out_strs,
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1488267006-29945-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/[email protected]

Reviewed-by
#2 lore raw
Quoted 19 lines · Sakari Ailus

of_property_read_string_array() is documented to return the number of strings present in a string array property if its target string buffer is NULL. What is not documented, however, is that is returned if the buffer is non-NULL. It returns the number of strings read. Document this, as well as the error codes.

---
 include/linux/of.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/of.h +0 -0
index d72f010..5856765 100644
@@ -952,7 +952,11 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
  * 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.

include/linux/of.h static inline int of_property_count_u64_elems(const struct device_node *np, · line 962

Quoted 10 lines
include/linux/of.h +5 -1
  *
- * If @out_strs is NULL, the number of strings in the property is returned.
+ * If @out_strs is NULL, the number of strings in the property is returned. If
+ * $out_strs is non-NULL, returns the number of strings read. On error, the
+ * function returns -EINVAL if the property does not exist, -ENODATA if
+ * property does not have a value, and -EILSEQ if the string is not
+ * null-terminated within the length of the property data.
  */
 static inline int of_property_read_string_array(const struct device_node *np,
 						const char *propname, const char **out_strs,

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html