diff options
author | Eliad Peller <eliad@wizery.com> | 2015-11-15 13:47:22 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2015-11-15 22:12:50 +0100 |
commit | 9ba3c9d2ee39ee7a4f8a2d7d69e417e267a22827 (patch) | |
tree | 11b741edd009ee6f28547d5f25357391471835f8 /backport/compat/backport-3.18.c | |
parent | 4fe7fc892a124f55a0e8b1b6913f41e71cbba09c (diff) |
backports: add of_find_property_value_of_size()
Upstream commit: b3cb62500ef43511480f416f957cb6d60c24984b
commit 2e98a32a274274fca0e6e ("backport: add
of_property_read_u64_array()") added a call
to of_find_property_value_of_size(), which is a
static function, causing compilation error.
Implement it locally as well.
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
[remove of_find_property_value_of_size() from backport-3.10.c]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'backport/compat/backport-3.18.c')
-rw-r--r-- | backport/compat/backport-3.18.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/backport/compat/backport-3.18.c b/backport/compat/backport-3.18.c index bed5d96b..f0f7fd8a 100644 --- a/backport/compat/backport-3.18.c +++ b/backport/compat/backport-3.18.c @@ -225,6 +225,34 @@ EXPORT_SYMBOL_GPL(bit_wait_timeout); #ifdef CONFIG_OF /** + * of_find_property_value_of_size + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @len: requested length of property value + * + * Search for a property in a device node and valid the requested size. + * Returns the property value on success, -EINVAL if the property does not + * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * + */ +void *of_find_property_value_of_size(const struct device_node *np, + const char *propname, u32 len) +{ + struct property *prop = of_find_property(np, propname, NULL); + + if (!prop) + return ERR_PTR(-EINVAL); + if (!prop->value) + return ERR_PTR(-ENODATA); + if (len > prop->length) + return ERR_PTR(-EOVERFLOW); + + return prop->value; +} + +/** * of_property_read_u64_array - Find and read an array of 64 bit integers * from a property. * |