From 7c866c6a600e435cf92f764b831d9cb3234ca0b4 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 24 Oct 2016 12:05:57 +1100 Subject: 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 Reviewed-by: Thomas Huth Reviewed-by: Michael Roth --- hw/ppc/spapr_vio.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'hw/ppc/spapr_vio.c') 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; } -- cgit v1.2.3