backports: add of_find_property_value_of_size()
PATCH 1/1 backports: add of_find_property_value_of_size()
From: Eliad Peller <[email protected]>
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.
--- backport/compat/backport-3.18.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
backport/compat/backport-3.18.c +28 -0
@@ -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. +* +*/ +static 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. *
Signature · 4 lines
2.5.0 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH v2 1/1 backports: add of_find_property_value_of_size()
From: Eliad Peller <[email protected]>
commit 2e98a32a274274fca0e6e ("backport: addof_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.
---
I did some changes to this patch, I hope they are ok.
backport/backport-include/linux/of.h | 6 +++--- backport/compat/backport-3.10.c | 28 ---------------------------- backport/compat/backport-3.18.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 31 deletions(-)
backport/backport-include/linux/of.h +3 -3
@@ -82,9 +82,6 @@ static inline const void *of_get_property(const struct device_node *node,extern int of_property_read_u32_index (const struct device_node *np,const char *propname,u32 index,u32 *out_value); -/* This is static in the kernel, but we need it in multiple places */ -void *of_find_property_value_of_size (const struct device_node *np, -const char *propname,u32 len);#else static inline int of_property_read_u32_index (const struct device_node *np,const char *propname,u32 index,u32 *out_value)
@@ -170,6 +167,9 @@ static inline struct device_node *of_find_compatible_node(#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,18 ,0 )#define of_property_read_u64_array LINUX_BACKPORT(of_property_read_u64_array)#ifdef CONFIG_OF +/* This is static in the kernel, but we need it in multiple places */ +void *of_find_property_value_of_size (const struct device_node *np, +const char *propname,u32 len); extern int of_property_read_u64_array(const struct device_node *np, const char *propname, u64 *out_values,
backport/compat/backport-3.10.c +0 -28
@@ -123,34 +123,6 @@ EXPORT_SYMBOL_GPL(pci_vfs_assigned);#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_u32_index - Find and read a u32 from a multi-value property. * * @np: device node from which the property value is to be read.
backport/compat/backport-3.18.c +28 -0
@@ -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. *
Signature · 4 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe backports" in
Quoted 13 lines · Hauke Mehrtens
From: Eliad Peller <[email protected]>
commit
2e98a32a274274fca0e6e("backport: addof_property_read_u64_array()") added a call
toof_find_property_value_of_size(), which is a
static function, causing compilation error.Implement it locally as well.
Signed-off-by Eliad Peller <[email protected]>Signed-off-by Emmanuel Grumbach <[email protected]>[remove of_find_property_value_of_size() from backport-3.10.c]Signed-off-by Hauke Mehrtens <[email protected]>
Quoted 9 lines
---
I did some changes to this patch, I hope they are ok.
backport/backport-include/linux/of.h | 6 +++--- backport/compat/backport-3.10.c | 28 ---------------------------- backport/compat/backport-3.18.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 31 deletions(-)
Thank you for the patch, it was applied.
Hauke
--
To unsubscribe from this list: send the line "unsubscribe backports" in