of: Add of_write_number helper
The counterpart to of_read_number: Write a 32bit or 64bit number to a devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
b26b7ef0f0
commit
43327fe374
11
include/of.h
11
include/of.h
|
@ -96,6 +96,17 @@ static inline u64 of_read_number(const __be32 *cell, int size)
|
|||
return r;
|
||||
}
|
||||
|
||||
/* Helper to write a big number; size is in cells (not bytes) */
|
||||
static inline void of_write_number(void *__cell, u64 val, int size)
|
||||
{
|
||||
__be32 *cell = __cell;
|
||||
|
||||
while (size--) {
|
||||
cell[size] = cpu_to_be32(val);
|
||||
val >>= 32;
|
||||
}
|
||||
}
|
||||
|
||||
int of_property_read_u32_array(const struct device_node *np,
|
||||
const char *propname, u32 *out_values,
|
||||
size_t sz);
|
||||
|
|
Loading…
Reference in New Issue