devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt: add helper functions to read u32 and string property values
@ 2011-06-30 15:56 Thomas Abraham
       [not found] ` <1309449370-9554-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Abraham @ 2011-06-30 15:56 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ; +Cc: patches-QSEj5FYQhm4dnm+yROfE0A

Add helper functions to retrive unsigned integer and string property values from
properties of a device node. These helper functions can be used to lookup a
property in a device node, perform error checking and read the property value.

[grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org: Proposal and initial implementation]
Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/of/base.c  |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/of.h |    4 +++
 2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 632ebae..4823b53 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -596,6 +596,65 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
 /**
+ * of_property_read_u32 - Find a property in a device node and read the
+ *				32-bit property value
+ * @np:		device node from which the property value is to be read.
+ * @propname:	name of the property to be searched.
+ * @out_value:	returned value, valid if return value is 0.
+ *
+ * Search for a property in a device node and read a 32-bit value from a
+ * property. Returns -EINVAL, if the property does not exist, -ENODATA, if
+ * property does not have a value, -EOVERFLOW, if the property data isn't
+ * large enough, and 0 on success.
+ *
+ * The out_value is modified only if a valid u32 value can be decoded.
+ */
+int of_property_read_u32(struct device_node *np, char *propname, u32 *out_value)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if (sizeof(*out_value) > prop->length)
+		return -EOVERFLOW;
+	*out_value = be32_to_cpup(prop->value);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_property_read_u32);
+
+/**
+ * of_property_read_string - Find a property in a device node and return a
+ *				pointer to the property string value.
+ * @np:		device node from which the property value is to be read.
+ * @propname:	name of the property to be searched.
+ * @out_string:	pointer to a null terminated string, valid only if the return
+ *		value is 0.
+ *
+ * Returns a pointer to a null terminated property value string. Returns
+ * -EINVAL, if the property does not exist, -ENODATA, if property does not have
+ * a value, -EILSEQ, if the string is not null-terminated within the length of
+ * the property value, and 0 on success.
+ *
+ * The out_string value is modified only if a valid string can be decoded.
+ */
+int of_property_read_string(struct device_node *np, char *propname,
+				char **out_string)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if (strnlen(prop->value, prop->length) == prop->length)
+		return -EILSEQ;
+	*out_string = prop->value;
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_property_read_string);
+
+/**
  * of_parse_phandle - Resolve a phandle property to a device_node pointer
  * @np: Pointer to device node holding phandle property
  * @phandle_name: Name of property holding a phandle value
diff --git a/include/linux/of.h b/include/linux/of.h
index bfc0ed1..4fc4c1b 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -195,6 +195,10 @@ extern struct device_node *of_find_node_with_property(
 extern struct property *of_find_property(const struct device_node *np,
 					 const char *name,
 					 int *lenp);
+extern int of_property_read_u32(struct device_node *np, char *propname,
+					u32 *out_value);
+extern int of_property_read_string(struct device_node *np, char *propname,
+					char **out_string);
 extern int of_device_is_compatible(const struct device_node *device,
 				   const char *);
 extern int of_device_is_available(const struct device_node *device);
-- 
1.6.6.rc2

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

* Re: [PATCH] dt: add helper functions to read u32 and string property values
       [not found] ` <1309449370-9554-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2011-06-30 18:13   ` Grant Likely
       [not found]     ` <20110630181353.GA6674-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2011-06-30 18:13 UTC (permalink / raw)
  To: Thomas Abraham
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Thu, Jun 30, 2011 at 09:26:10PM +0530, Thomas Abraham wrote:
> Add helper functions to retrive unsigned integer and string property values from
> properties of a device node. These helper functions can be used to lookup a
> property in a device node, perform error checking and read the property value.
> 
> [grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org: Proposal and initial implementation]
> Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Merged, thanks.  Bonus points to anyone who submits patches converting
existing code to this new api.

g.

> ---
>  drivers/of/base.c  |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/of.h |    4 +++
>  2 files changed, 63 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 632ebae..4823b53 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -596,6 +596,65 @@ struct device_node *of_find_node_by_phandle(phandle handle)
>  EXPORT_SYMBOL(of_find_node_by_phandle);
>  
>  /**
> + * of_property_read_u32 - Find a property in a device node and read the
> + *				32-bit property value
> + * @np:		device node from which the property value is to be read.
> + * @propname:	name of the property to be searched.
> + * @out_value:	returned value, valid if return value is 0.
> + *
> + * Search for a property in a device node and read a 32-bit value from a
> + * property. Returns -EINVAL, if the property does not exist, -ENODATA, if
> + * property does not have a value, -EOVERFLOW, if the property data isn't
> + * large enough, and 0 on success.
> + *
> + * The out_value is modified only if a valid u32 value can be decoded.
> + */
> +int of_property_read_u32(struct device_node *np, char *propname, u32 *out_value)
> +{
> +	struct property *prop = of_find_property(np, propname, NULL);
> +
> +	if (!prop)
> +		return -EINVAL;
> +	if (!prop->value)
> +		return -ENODATA;
> +	if (sizeof(*out_value) > prop->length)
> +		return -EOVERFLOW;
> +	*out_value = be32_to_cpup(prop->value);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(of_property_read_u32);
> +
> +/**
> + * of_property_read_string - Find a property in a device node and return a
> + *				pointer to the property string value.
> + * @np:		device node from which the property value is to be read.
> + * @propname:	name of the property to be searched.
> + * @out_string:	pointer to a null terminated string, valid only if the return
> + *		value is 0.
> + *
> + * Returns a pointer to a null terminated property value string. Returns
> + * -EINVAL, if the property does not exist, -ENODATA, if property does not have
> + * a value, -EILSEQ, if the string is not null-terminated within the length of
> + * the property value, and 0 on success.
> + *
> + * The out_string value is modified only if a valid string can be decoded.
> + */
> +int of_property_read_string(struct device_node *np, char *propname,
> +				char **out_string)
> +{
> +	struct property *prop = of_find_property(np, propname, NULL);
> +	if (!prop)
> +		return -EINVAL;
> +	if (!prop->value)
> +		return -ENODATA;
> +	if (strnlen(prop->value, prop->length) == prop->length)
> +		return -EILSEQ;
> +	*out_string = prop->value;
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(of_property_read_string);
> +
> +/**
>   * of_parse_phandle - Resolve a phandle property to a device_node pointer
>   * @np: Pointer to device node holding phandle property
>   * @phandle_name: Name of property holding a phandle value
> diff --git a/include/linux/of.h b/include/linux/of.h
> index bfc0ed1..4fc4c1b 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -195,6 +195,10 @@ extern struct device_node *of_find_node_with_property(
>  extern struct property *of_find_property(const struct device_node *np,
>  					 const char *name,
>  					 int *lenp);
> +extern int of_property_read_u32(struct device_node *np, char *propname,
> +					u32 *out_value);
> +extern int of_property_read_string(struct device_node *np, char *propname,
> +					char **out_string);
>  extern int of_device_is_compatible(const struct device_node *device,
>  				   const char *);
>  extern int of_device_is_available(const struct device_node *device);
> -- 
> 1.6.6.rc2
> 

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

* Re: [PATCH] dt: add helper functions to read u32 and string property values
       [not found]     ` <20110630181353.GA6674-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2011-07-03  3:55       ` Shawn Guo
       [not found]         ` <20110703035527.GB9742-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2011-07-03  3:55 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Thu, Jun 30, 2011 at 12:13:53PM -0600, Grant Likely wrote:
> On Thu, Jun 30, 2011 at 09:26:10PM +0530, Thomas Abraham wrote:
> > Add helper functions to retrive unsigned integer and string property values from
> > properties of a device node. These helper functions can be used to lookup a
> > property in a device node, perform error checking and read the property value.
> > 
> > [grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org: Proposal and initial implementation]
> > Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> 
> Merged, thanks.  Bonus points to anyone who submits patches converting
> existing code to this new api.
> 
> g.
> 
> > ---
> >  drivers/of/base.c  |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/of.h |    4 +++
> >  2 files changed, 63 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > index 632ebae..4823b53 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -596,6 +596,65 @@ struct device_node *of_find_node_by_phandle(phandle handle)
> >  EXPORT_SYMBOL(of_find_node_by_phandle);
> >  
> >  /**
> > + * of_property_read_u32 - Find a property in a device node and read the
> > + *				32-bit property value
> > + * @np:		device node from which the property value is to be read.
> > + * @propname:	name of the property to be searched.
> > + * @out_value:	returned value, valid if return value is 0.
> > + *
> > + * Search for a property in a device node and read a 32-bit value from a
> > + * property. Returns -EINVAL, if the property does not exist, -ENODATA, if
> > + * property does not have a value, -EOVERFLOW, if the property data isn't
> > + * large enough, and 0 on success.
> > + *
> > + * The out_value is modified only if a valid u32 value can be decoded.
> > + */
> > +int of_property_read_u32(struct device_node *np, char *propname, u32 *out_value)
> > +{
> > +	struct property *prop = of_find_property(np, propname, NULL);
> > +
> > +	if (!prop)
> > +		return -EINVAL;
> > +	if (!prop->value)
> > +		return -ENODATA;
> > +	if (sizeof(*out_value) > prop->length)
> > +		return -EOVERFLOW;
> > +	*out_value = be32_to_cpup(prop->value);
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(of_property_read_u32);
> > +
> > +/**
> > + * of_property_read_string - Find a property in a device node and return a
> > + *				pointer to the property string value.
> > + * @np:		device node from which the property value is to be read.
> > + * @propname:	name of the property to be searched.
> > + * @out_string:	pointer to a null terminated string, valid only if the return
> > + *		value is 0.
> > + *
> > + * Returns a pointer to a null terminated property value string. Returns
> > + * -EINVAL, if the property does not exist, -ENODATA, if property does not have
> > + * a value, -EILSEQ, if the string is not null-terminated within the length of
> > + * the property value, and 0 on success.
> > + *
> > + * The out_string value is modified only if a valid string can be decoded.
> > + */
> > +int of_property_read_string(struct device_node *np, char *propname,
> > +				char **out_string)

When converting my dt code to use this api, the following type
mismatch warning is being seen in a lot of places.

'char **' but argument is of type 'const char **'

This is because the existing codes usually get string from
of_get_property and assign it to a 'const char *'.

I'm wondering if we should drop the const during converting or
change the api with const added to out_string to get converting
a little bit easier.

Regards,
Shawn

> > +{
> > +	struct property *prop = of_find_property(np, propname, NULL);
> > +	if (!prop)
> > +		return -EINVAL;
> > +	if (!prop->value)
> > +		return -ENODATA;
> > +	if (strnlen(prop->value, prop->length) == prop->length)
> > +		return -EILSEQ;
> > +	*out_string = prop->value;
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(of_property_read_string);
> > +
> > +/**
> >   * of_parse_phandle - Resolve a phandle property to a device_node pointer
> >   * @np: Pointer to device node holding phandle property
> >   * @phandle_name: Name of property holding a phandle value
> > diff --git a/include/linux/of.h b/include/linux/of.h
> > index bfc0ed1..4fc4c1b 100644
> > --- a/include/linux/of.h
> > +++ b/include/linux/of.h
> > @@ -195,6 +195,10 @@ extern struct device_node *of_find_node_with_property(
> >  extern struct property *of_find_property(const struct device_node *np,
> >  					 const char *name,
> >  					 int *lenp);
> > +extern int of_property_read_u32(struct device_node *np, char *propname,
> > +					u32 *out_value);
> > +extern int of_property_read_string(struct device_node *np, char *propname,
> > +					char **out_string);
> >  extern int of_device_is_compatible(const struct device_node *device,
> >  				   const char *);
> >  extern int of_device_is_available(const struct device_node *device);
> > -- 
> > 1.6.6.rc2
> > 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
> 

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

* Re: [PATCH] dt: add helper functions to read u32 and string property values
       [not found]         ` <20110703035527.GB9742-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
@ 2011-07-03 21:03           ` Grant Likely
       [not found]             ` <20110703210312.GA13742-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2011-07-03 21:03 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Sun, Jul 03, 2011 at 11:55:28AM +0800, Shawn Guo wrote:
> On Thu, Jun 30, 2011 at 12:13:53PM -0600, Grant Likely wrote:
> > On Thu, Jun 30, 2011 at 09:26:10PM +0530, Thomas Abraham wrote:
> > > Add helper functions to retrive unsigned integer and string property values from
> > > properties of a device node. These helper functions can be used to lookup a
> > > property in a device node, perform error checking and read the property value.
> > > 
> > > [grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org: Proposal and initial implementation]
> > > Signed-off-by: Thomas Abraham <thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > 
> > Merged, thanks.  Bonus points to anyone who submits patches converting
> > existing code to this new api.
> > 
> > g.
> > 
> > > ---
> > >  drivers/of/base.c  |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  include/linux/of.h |    4 +++
> > >  2 files changed, 63 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > > index 632ebae..4823b53 100644
> > > --- a/drivers/of/base.c
> > > +++ b/drivers/of/base.c
> > > @@ -596,6 +596,65 @@ struct device_node *of_find_node_by_phandle(phandle handle)
> > >  EXPORT_SYMBOL(of_find_node_by_phandle);
> > >  
> > >  /**
> > > + * of_property_read_u32 - Find a property in a device node and read the
> > > + *				32-bit property value
> > > + * @np:		device node from which the property value is to be read.
> > > + * @propname:	name of the property to be searched.
> > > + * @out_value:	returned value, valid if return value is 0.
> > > + *
> > > + * Search for a property in a device node and read a 32-bit value from a
> > > + * property. Returns -EINVAL, if the property does not exist, -ENODATA, if
> > > + * property does not have a value, -EOVERFLOW, if the property data isn't
> > > + * large enough, and 0 on success.
> > > + *
> > > + * The out_value is modified only if a valid u32 value can be decoded.
> > > + */
> > > +int of_property_read_u32(struct device_node *np, char *propname, u32 *out_value)
> > > +{
> > > +	struct property *prop = of_find_property(np, propname, NULL);
> > > +
> > > +	if (!prop)
> > > +		return -EINVAL;
> > > +	if (!prop->value)
> > > +		return -ENODATA;
> > > +	if (sizeof(*out_value) > prop->length)
> > > +		return -EOVERFLOW;
> > > +	*out_value = be32_to_cpup(prop->value);
> > > +	return 0;
> > > +}
> > > +EXPORT_SYMBOL_GPL(of_property_read_u32);
> > > +
> > > +/**
> > > + * of_property_read_string - Find a property in a device node and return a
> > > + *				pointer to the property string value.
> > > + * @np:		device node from which the property value is to be read.
> > > + * @propname:	name of the property to be searched.
> > > + * @out_string:	pointer to a null terminated string, valid only if the return
> > > + *		value is 0.
> > > + *
> > > + * Returns a pointer to a null terminated property value string. Returns
> > > + * -EINVAL, if the property does not exist, -ENODATA, if property does not have
> > > + * a value, -EILSEQ, if the string is not null-terminated within the length of
> > > + * the property value, and 0 on success.
> > > + *
> > > + * The out_string value is modified only if a valid string can be decoded.
> > > + */
> > > +int of_property_read_string(struct device_node *np, char *propname,
> > > +				char **out_string)
> 
> When converting my dt code to use this api, the following type
> mismatch warning is being seen in a lot of places.
> 
> 'char **' but argument is of type 'const char **'
> 
> This is because the existing codes usually get string from
> of_get_property and assign it to a 'const char *'.
> 
> I'm wondering if we should drop the const during converting or
> change the api with const added to out_string to get converting
> a little bit easier.

Add the const to out_string.  It's the right thing to do.  Can you
craft and post a patch doing so?

g.

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

* [PATCH] dt: add 'const' for of_property_read_string parameter **out_string
       [not found]             ` <20110703210312.GA13742-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2011-07-04  1:01               ` Shawn Guo
       [not found]                 ` <1309741278-26776-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2011-07-04  1:01 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ; +Cc: patches-QSEj5FYQhm4dnm+yROfE0A

The existing dt codes usually call of_get_property to get a string
property and save it as a 'const char *'.  The patch adds'const' for
of_property_read_string parameter **out_string to make the converting
of existing code a little easier.

Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/of/base.c  |    2 +-
 include/linux/of.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index b8b65fd..57ec27b 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -639,7 +639,7 @@ EXPORT_SYMBOL_GPL(of_property_read_u32);
  * The out_string pointer is modified only if a valid string can be decoded.
  */
 int of_property_read_string(struct device_node *np, char *propname,
-				char **out_string)
+				const char **out_string)
 {
 	struct property *prop = of_find_property(np, propname, NULL);
 	if (!prop)
diff --git a/include/linux/of.h b/include/linux/of.h
index 4fc4c1b..b238520 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -198,7 +198,7 @@ extern struct property *of_find_property(const struct device_node *np,
 extern int of_property_read_u32(struct device_node *np, char *propname,
 					u32 *out_value);
 extern int of_property_read_string(struct device_node *np, char *propname,
-					char **out_string);
+					const char **out_string);
 extern int of_device_is_compatible(const struct device_node *device,
 				   const char *);
 extern int of_device_is_available(const struct device_node *device);
-- 
1.7.4.1

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

* Re: [PATCH] dt: add 'const' for of_property_read_string parameter **out_string
       [not found]                 ` <1309741278-26776-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2011-07-04  5:47                   ` Grant Likely
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2011-07-04  5:47 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	patches-QSEj5FYQhm4dnm+yROfE0A

On Mon, Jul 04, 2011 at 09:01:18AM +0800, Shawn Guo wrote:
> The existing dt codes usually call of_get_property to get a string
> property and save it as a 'const char *'.  The patch adds'const' for
> of_property_read_string parameter **out_string to make the converting
> of existing code a little easier.
> 
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Applied, thanks.

g.

> ---
>  drivers/of/base.c  |    2 +-
>  include/linux/of.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index b8b65fd..57ec27b 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -639,7 +639,7 @@ EXPORT_SYMBOL_GPL(of_property_read_u32);
>   * The out_string pointer is modified only if a valid string can be decoded.
>   */
>  int of_property_read_string(struct device_node *np, char *propname,
> -				char **out_string)
> +				const char **out_string)
>  {
>  	struct property *prop = of_find_property(np, propname, NULL);
>  	if (!prop)
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 4fc4c1b..b238520 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -198,7 +198,7 @@ extern struct property *of_find_property(const struct device_node *np,
>  extern int of_property_read_u32(struct device_node *np, char *propname,
>  					u32 *out_value);
>  extern int of_property_read_string(struct device_node *np, char *propname,
> -					char **out_string);
> +					const char **out_string);
>  extern int of_device_is_compatible(const struct device_node *device,
>  				   const char *);
>  extern int of_device_is_available(const struct device_node *device);
> -- 
> 1.7.4.1
> 

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

end of thread, other threads:[~2011-07-04  5:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-30 15:56 [PATCH] dt: add helper functions to read u32 and string property values Thomas Abraham
     [not found] ` <1309449370-9554-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-06-30 18:13   ` Grant Likely
     [not found]     ` <20110630181353.GA6674-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-03  3:55       ` Shawn Guo
     [not found]         ` <20110703035527.GB9742-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-07-03 21:03           ` Grant Likely
     [not found]             ` <20110703210312.GA13742-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-04  1:01               ` [PATCH] dt: add 'const' for of_property_read_string parameter **out_string Shawn Guo
     [not found]                 ` <1309741278-26776-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-07-04  5:47                   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).