All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-acpi@vger.kernel.org, devicetree@vger.kernel.org,
	sudeep.holla@arm.com, lorenzo.pieralisi@arm.com,
	mika.westerberg@linux.intel.com, rafael@kernel.org,
	mark.rutland@arm.com, broonie@kernel.org, robh@kernel.org,
	ahs3@redhat.com
Subject: Re: [PATCH 3/3] device property: of_property_read_string_array() returns number of strings
Date: Mon, 13 Mar 2017 23:24:01 +0100	[thread overview]
Message-ID: <1840694.EMHZKJ1jEg@aspire.rjw.lan> (raw)
In-Reply-To: <1488806791-25488-4-git-send-email-sakari.ailus@linux.intel.com>

On Monday, March 06, 2017 03:26:31 PM Sakari Ailus wrote:
> of_property_read_string_array() returns number of strings read if the
> target array of pointers is non-NULL. fwnode_property_read_string_array()
> is documented to return 0 in that case. Fix this.

Well, if we want people to use fwnode_property_read_string_array() instead of
of_property_read_string_array(), it should better behave analogously, shouldn't it?

> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/base/property.c | 24 ++++++++++++++++++------
>  1 file changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 9224541a..e67ec24 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -544,12 +544,24 @@ static int __fwnode_property_read_string_array(struct fwnode_handle *fwnode,
>  					       const char *propname,
>  					       const char **val, size_t nval)
>  {
> -	if (is_of_node(fwnode))
> -		return val ?
> -			of_property_read_string_array(to_of_node(fwnode),
> -						      propname, val, nval) :
> -			of_property_count_strings(to_of_node(fwnode), propname);
> -	else if (is_acpi_node(fwnode))
> +	if (is_of_node(fwnode)) {
> +		int rval;
> +
> +		if (!val)
> +			return of_property_count_strings(to_of_node(fwnode),
> +							 propname);
> +
> +		rval = of_property_read_string_array(to_of_node(fwnode),
> +						     propname, val, nval);
> +
> +		if (rval < 0)
> +			return rval;
> +
> +		if (rval == nval)
> +			return 0;
> +
> +		return -EOVERFLOW;
> +	} else if (is_acpi_node(fwnode))
>  		return acpi_node_prop_read(fwnode, propname, DEV_PROP_STRING,
>  					   val, nval);
>  	else if (is_pset_node(fwnode)) {
> 

Thanks,
Rafael


  reply	other threads:[~2017-03-13 22:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06 13:26 [PATCH 0/3] Fwnode property API fixes for OF, pset Sakari Ailus
2017-03-06 13:26 ` [PATCH 1/3] device property: fwnode_property_read_string_array() may return -EILSEQ Sakari Ailus
     [not found]   ` <1488806791-25488-2-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-03-27 13:53     ` Mika Westerberg
2017-03-27 21:39       ` Sakari Ailus
2017-03-06 13:26 ` [PATCH 2/3] device property: Fix reading pset strings using array access functions Sakari Ailus
     [not found]   ` <1488806791-25488-3-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-03-07 23:51     ` kbuild test robot
2017-03-08  5:41   ` [PATCH v1.1 " Sakari Ailus
2017-03-06 13:26 ` [PATCH 3/3] device property: of_property_read_string_array() returns number of strings Sakari Ailus
2017-03-13 22:24   ` Rafael J. Wysocki [this message]
     [not found]     ` <1840694.EMHZKJ1jEg-yvgW3jdyMHm1GS7QM15AGw@public.gmane.org>
2017-03-14  7:17       ` Sakari Ailus
2017-03-14 16:57         ` Rafael J. Wysocki
2017-03-15 13:31   ` [PATCH v1.1 3/3] device property: fwnode_property_read_string_array() returns nr " Sakari Ailus
2017-03-27 13:36     ` Mika Westerberg
2017-03-27 21:46       ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1840694.EMHZKJ1jEg@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=ahs3@redhat.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.