All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] devicetree: Document of_property_read_string_array() better
@ 2017-02-28  7:30 Sakari Ailus
       [not found] ` <1488267006-29945-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2017-02-28  7:30 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, frowand.list-Re5JQEeQqe8AvxtiuMwx3w

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.

Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 include/linux/of.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index d72f010..5856765 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -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,
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] devicetree: Document of_property_read_string_array() better
       [not found] ` <1488267006-29945-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2017-03-02  6:52   ` Frank Rowand
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Rowand @ 2017-03-02  6:52 UTC (permalink / raw)
  To: Sakari Ailus, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A

On 02/27/17 23:30, Sakari Ailus wrote:
> 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.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  include/linux/of.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/of.h b/include/linux/of.h
> index d72f010..5856765 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -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,
> 

Thanks.

Reviewed-by: Frank Rowand <frank.rowand-7U/KSKJipcs@public.gmane.org>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] devicetree: Document of_property_read_string_array() better
@ 2017-02-23 21:40 Sakari Ailus
  0 siblings, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2017-02-23 21:40 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA

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.

Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 include/linux/of.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/of.h b/include/linux/of.h
index d72f010..0579156 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -953,6 +953,7 @@ static inline int of_property_count_u64_elems(const struct device_node *np,
  * 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.
+ * Otherwise, returns the number of strings read.
  */
 static inline int of_property_read_string_array(const struct device_node *np,
 						const char *propname, const char **out_strs,
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-02  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28  7:30 [PATCH 1/1] devicetree: Document of_property_read_string_array() better Sakari Ailus
     [not found] ` <1488267006-29945-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-03-02  6:52   ` Frank Rowand
  -- strict thread matches above, loose matches on Subject: below --
2017-02-23 21:40 Sakari Ailus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.