aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr_vio.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2016-10-24 12:05:57 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2016-10-28 09:38:26 +1100
commit7c866c6a600e435cf92f764b831d9cb3234ca0b4 (patch)
tree48017cbb60cb125b67f3a9813add60a0d55129cd /hw/ppc/spapr_vio.c
parent9b9a19080a6e548b91420ce7925f2ac81ef63ae8 (diff)
pseries: Consolidate construction of /chosen device tree node
For historical reasons, building the /chosen node in the guest device tree is split across several places and includes both parts which write the DT sequentially and others which use random access functions. This patch consolidates construction of the node into one place, using random access functions throughout. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw/ppc/spapr_vio.c')
-rw-r--r--hw/ppc/spapr_vio.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c
index 3648aa5960..2b67df0a97 100644
--- a/hw/ppc/spapr_vio.c
+++ b/hw/ppc/spapr_vio.c
@@ -665,28 +665,19 @@ out:
return ret;
}
-int spapr_populate_chosen_stdout(void *fdt, VIOsPAPRBus *bus)
+gchar *spapr_vio_stdout_path(VIOsPAPRBus *bus)
{
VIOsPAPRDevice *dev;
char *name, *path;
- int ret, offset;
dev = spapr_vty_get_default(bus);
- if (!dev)
- return 0;
-
- offset = fdt_path_offset(fdt, "/chosen");
- if (offset < 0) {
- return offset;
+ if (!dev) {
+ return NULL;
}
name = spapr_vio_get_dev_name(DEVICE(dev));
path = g_strdup_printf("/vdevice/%s", name);
- ret = fdt_setprop_string(fdt, offset, "linux,stdout-path", path);
-
g_free(name);
- g_free(path);
-
- return ret;
+ return path;
}