Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269371
b: refs/heads/master
c: 4cd7f7a
h: refs/heads/master
i:
  269369: b9f2861
  269367: c3fe97d
v: v3
  • Loading branch information
Jamie Iles authored and Grant Likely committed Oct 4, 2011
1 parent c1b9f47 commit 60cd8fc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85888069cf5d0f21312e3ee730458a5e3a553509
refs/heads/master: 4cd7f7a31178ff8a15ad2bc1258b9b2bf2cf51a4
29 changes: 29 additions & 0 deletions trunk/drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,35 @@ int of_property_read_u32_array(const struct device_node *np,
}
EXPORT_SYMBOL_GPL(of_property_read_u32_array);

/**
* of_property_read_u64 - Find and read a 64 bit integer from a property
* @np: device node from which the property value is to be read.
* @propname: name of the property to be searched.
* @out_value: pointer to return value, modified only if return value is 0.
*
* Search for a property in a device node and read a 64-bit value from
* it. Returns 0 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.
*
* The out_value is modified only if a valid u64 value can be decoded.
*/
int of_property_read_u64(const struct device_node *np, const char *propname,
u64 *out_value)
{
struct property *prop = of_find_property(np, propname, NULL);

if (!prop)
return -EINVAL;
if (!prop->value)
return -ENODATA;
if (sizeof(*out_value) > prop->length)
return -EOVERFLOW;
*out_value = of_read_number(prop->value, 2);
return 0;
}
EXPORT_SYMBOL_GPL(of_property_read_u64);

/**
* of_property_read_string - Find and read a string from a property
* @np: device node from which the property value is to be read.
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ extern int of_property_read_u32_array(const struct device_node *np,
const char *propname,
u32 *out_values,
size_t sz);
extern int of_property_read_u64(const struct device_node *np,
const char *propname, u64 *out_value);

extern int of_property_read_string(struct device_node *np,
const char *propname,
Expand Down Expand Up @@ -281,6 +283,12 @@ static inline const void *of_get_property(const struct device_node *node,
return NULL;
}

static inline int of_property_read_u64(const struct device_node *np,
const char *propname, u64 *out_value)
{
return -ENOSYS;
}

#define of_match_ptr(_ptr) NULL
#endif /* CONFIG_OF */

Expand Down

0 comments on commit 60cd8fc

Please sign in to comment.