diff options
author | Madhavan Srinivasan <maddy@linux.vnet.ibm.com> | 2017-06-22 17:45:17 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-06-27 15:31:52 +1000 |
commit | 3ae55cca0ea3609bd90f2208b492cda37abb1cfe (patch) | |
tree | 77c0787e6dd9b31331b7e6b417f358e713c7f544 /core | |
parent | 7e6499674f154d62d2f136778877cce8f6710df5 (diff) | |
download | skiboot-3ae55cca0ea3609bd90f2208b492cda37abb1cfe.zip skiboot-3ae55cca0ea3609bd90f2208b492cda37abb1cfe.tar.gz skiboot-3ae55cca0ea3609bd90f2208b492cda37abb1cfe.tar.bz2 |
dt: Add helper function for last_phandle updates
Add helper functions for "last_phandle" access/update and
modify functions to use helper functions.
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/device.c | 4 | ||||
-rw-r--r-- | core/fdt.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/device.c b/core/device.c index 42c47d1..df0f4e9 100644 --- a/core/device.c +++ b/core/device.c @@ -57,7 +57,7 @@ static struct dt_node *new_node(const char *name) list_head_init(&node->properties); list_head_init(&node->children); /* FIXME: locking? */ - node->phandle = ++last_phandle; + node->phandle = new_phandle(); return node; } @@ -469,7 +469,7 @@ struct dt_property *dt_add_property(struct dt_node *node, assert(size == 4); node->phandle = *(const u32 *)val; if (node->phandle >= last_phandle) - last_phandle = node->phandle; + set_last_phandle(node->phandle); return NULL; } @@ -191,11 +191,11 @@ void *create_dtb(const struct dt_node *root, bool exclusive) { void *fdt = NULL; size_t len = DEVICE_TREE_MAX_SIZE; - uint32_t old_last_phandle = last_phandle; + uint32_t old_last_phandle = get_last_phandle(); int ret; do { - last_phandle = old_last_phandle; + set_last_phandle(old_last_phandle); fdt_error = 0; fdt = malloc(len); if (!fdt) { @@ -244,10 +244,10 @@ static int64_t opal_get_device_tree(uint32_t phandle, return OPAL_PARAMETER; fdt_error = 0; - old_last_phandle = last_phandle; + old_last_phandle = get_last_phandle(); ret = __create_dtb(fdt, len, root, true); if (ret) { - last_phandle = old_last_phandle; + set_last_phandle(old_last_phandle); if (ret == -FDT_ERR_NOSPACE) return OPAL_NO_MEM; |