diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-03-28 15:22:19 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-03-29 00:00:30 +0200 |
commit | b0b027cee090a1e3278960e1c8257213fda40f10 (patch) | |
tree | b724d2926fd71fb1c5feab5fab63e7a3bed0aa16 /drivers/base | |
parent | 0f194992c85f972ee99f176eb78a5860cef78573 (diff) | |
download | linux-b0b027cee090a1e3278960e1c8257213fda40f10.tar.bz2 |
device property: fwnode_property_read_string_array() returns nr of strings
Functionally fwnode_property_read_string_array() should match
of_property_read_string_array() and work as a drop-in substitute for the
latter. of_property_read_string_array() returns the number of strings read
if the target string pointer array is non-NULL. Make
fwnode_property_read_string_array() do the same.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/property.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c index 166cfdb5e851..71520454c038 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -177,7 +177,7 @@ static int pset_prop_read_string_array(struct property_set *pset, memcpy(strings, pointer, length); - return 0; + return array_len; } static int pset_prop_read_string(struct property_set *pset, @@ -364,8 +364,8 @@ EXPORT_SYMBOL_GPL(device_property_read_u64_array); * Function reads an array of string properties with @propname from the device * firmware description and stores them to @val if found. * - * Return: number of values if @val was %NULL, - * %0 if the property was found (success), + * Return: number of values read on success if @val is non-NULL, + * number of values available on success if @val is NULL, * %-EINVAL if given arguments are not valid, * %-ENODATA if the property does not have a value, * %-EPROTO or %-EILSEQ if the property is not an array of strings, @@ -605,8 +605,8 @@ static int __fwnode_property_read_string(struct fwnode_handle *fwnode, * Read an string list property @propname from the given firmware node and store * them to @val if found. * - * Return: number of values if @val was %NULL, - * %0 if the property was found (success), + * Return: number of values read on success if @val is non-NULL, + * number of values available on success if @val is NULL, * %-EINVAL if given arguments are not valid, * %-ENODATA if the property does not have a value, * %-EPROTO or %-EILSEQ if the property is not an array of strings, @@ -653,7 +653,7 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode, !IS_ERR_OR_NULL(fwnode->secondary)) ret = __fwnode_property_read_string(fwnode->secondary, propname, val); - return ret; + return ret < 0 ? ret : 0; } EXPORT_SYMBOL_GPL(fwnode_property_read_string); |