mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
Merge remote-tracking branches 'regulator/topic/doc', 'regulator/topic/enable', 'regulator/topic/fan53555', 'regulator/topic/fixed', 'regulator/topic/gpio', 'regulator/topic/lp3971', 'regulator/topic/lp872x' and 'regulator/topic/max14577' into regulator-next
This commit is contained in:
parent
c9cbbd4fc0
7f196ec938
ca5d1b3524
df948bbf48
f1b3f9031d
1f5a9623eb
a1985d469d
ad5ec6cdb2
4d047d6c1f
commit
794016f9dc
13 changed files with 224 additions and 78 deletions
|
|
@ -903,6 +903,38 @@ struct device_node *of_find_node_by_phandle(phandle handle)
|
|||
}
|
||||
EXPORT_SYMBOL(of_find_node_by_phandle);
|
||||
|
||||
/**
|
||||
* of_property_count_elems_of_size - Count the number of elements in a property
|
||||
*
|
||||
* @np: device node from which the property value is to be read.
|
||||
* @propname: name of the property to be searched.
|
||||
* @elem_size: size of the individual element
|
||||
*
|
||||
* Search for a property in a device node and count the number of elements of
|
||||
* size elem_size in it. Returns number of elements on sucess, -EINVAL if the
|
||||
* property does not exist or its length does not match a multiple of elem_size
|
||||
* and -ENODATA if the property does not have a value.
|
||||
*/
|
||||
int of_property_count_elems_of_size(const struct device_node *np,
|
||||
const char *propname, int elem_size)
|
||||
{
|
||||
struct property *prop = of_find_property(np, propname, NULL);
|
||||
|
||||
if (!prop)
|
||||
return -EINVAL;
|
||||
if (!prop->value)
|
||||
return -ENODATA;
|
||||
|
||||
if (prop->length % elem_size != 0) {
|
||||
pr_err("size of %s in node %s is not a multiple of %d\n",
|
||||
propname, np->full_name, elem_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return prop->length / elem_size;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_property_count_elems_of_size);
|
||||
|
||||
/**
|
||||
* of_find_property_value_of_size
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue