From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUde2-0002b0-Ta for qemu-devel@nongnu.org; Tue, 02 Aug 2016 13:38:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUddx-0007Dr-CY for qemu-devel@nongnu.org; Tue, 02 Aug 2016 13:38:21 -0400 Received: from 6.mo179.mail-out.ovh.net ([46.105.56.76]:50768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUddx-0007Dg-2d for qemu-devel@nongnu.org; Tue, 02 Aug 2016 13:38:17 -0400 Received: from player732.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 302561008396 for ; Tue, 2 Aug 2016 19:38:16 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Tue, 2 Aug 2016 19:38:00 +0200 Message-Id: <1470159481-28082-2-git-send-email-clg@kaod.org> In-Reply-To: <1470159481-28082-1-git-send-email-clg@kaod.org> References: <1470159481-28082-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 1/2] hw/ppc: use error_report instead of fprintf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-ppc@nongnu.org Cc: David Gibson , qemu-devel@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Signed-off-by: C=C3=A9dric Le Goater --- Changes since v1: - fixed _FDT() macro hw/ppc/spapr.c | 12 ++++++------ hw/ppc/spapr_drc.c | 8 ++++---- hw/ppc/spapr_iommu.c | 4 ++-- hw/ppc/spapr_rtas.c | 13 +++++++------ hw/ppc/spapr_vio.c | 3 ++- include/hw/ppc/fdt.h | 8 +++++--- 6 files changed, 26 insertions(+), 22 deletions(-) Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr.c +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr.c @@ -647,13 +647,13 @@ static void spapr_populate_cpu_dt(CPUSta _FDT((fdt_setprop_cell(fdt, offset, "d-cache-size", pcc->l1_dcache_size))); } else { - fprintf(stderr, "Warning: Unknown L1 dcache size for cpu\n"); + error_report("Warning: Unknown L1 dcache size for cpu"); } if (pcc->l1_icache_size) { _FDT((fdt_setprop_cell(fdt, offset, "i-cache-size", pcc->l1_icache_size))); } else { - fprintf(stderr, "Warning: Unknown L1 icache size for cpu\n"); + error_report("Warning: Unknown L1 icache size for cpu"); } =20 _FDT((fdt_setprop_cell(fdt, offset, "timebase-frequency", tbfreq))); @@ -944,20 +944,20 @@ static void spapr_finalize_fdt(sPAPRMach =20 ret =3D spapr_populate_memory(spapr, fdt); if (ret < 0) { - fprintf(stderr, "couldn't setup memory nodes in fdt\n"); + error_report("couldn't setup memory nodes in fdt"); exit(1); } =20 ret =3D spapr_populate_vdevice(spapr->vio_bus, fdt); if (ret < 0) { - fprintf(stderr, "couldn't setup vio devices in fdt\n"); + error_report("couldn't setup vio devices in fdt"); exit(1); } =20 if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL)) { ret =3D spapr_rng_populate_dt(fdt); if (ret < 0) { - fprintf(stderr, "could not set up rng device in the fdt\n"); + error_report("could not set up rng device in the fdt"); exit(1); } } @@ -973,7 +973,7 @@ static void spapr_finalize_fdt(sPAPRMach /* RTAS */ ret =3D spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size); if (ret < 0) { - fprintf(stderr, "Couldn't set up RTAS device tree properties\n")= ; + error_report("Couldn't set up RTAS device tree properties"); } =20 /* cpus */ Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr_drc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr_drc.c +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr_drc.c @@ -816,7 +816,7 @@ int spapr_drc_populate_dt(void *fdt, int drc_indexes->data, drc_indexes->len * sizeof(uint32_t)); if (ret) { - fprintf(stderr, "Couldn't create ibm,drc-indexes property\n"); + error_report("Couldn't create ibm,drc-indexes property"); goto out; } =20 @@ -824,21 +824,21 @@ int spapr_drc_populate_dt(void *fdt, int drc_power_domains->data, drc_power_domains->len * sizeof(uint32_t)); if (ret) { - fprintf(stderr, "Couldn't finalize ibm,drc-power-domains propert= y\n"); + error_report("Couldn't finalize ibm,drc-power-domains property")= ; goto out; } =20 ret =3D fdt_setprop(fdt, fdt_offset, "ibm,drc-names", drc_names->str, drc_names->len); if (ret) { - fprintf(stderr, "Couldn't finalize ibm,drc-names property\n"); + error_report("Couldn't finalize ibm,drc-names property"); goto out; } =20 ret =3D fdt_setprop(fdt, fdt_offset, "ibm,drc-types", drc_types->str, drc_types->len); if (ret) { - fprintf(stderr, "Couldn't finalize ibm,drc-types property\n"); + error_report("Couldn't finalize ibm,drc-types property"); goto out; } =20 Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr_iommu.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr_iommu.c +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr_iommu.c @@ -310,8 +310,8 @@ sPAPRTCETable *spapr_tce_new_table(Devic char tmp[32]; =20 if (spapr_tce_find_by_liobn(liobn)) { - fprintf(stderr, "Attempted to create TCE table with duplicate" - " LIOBN 0x%x\n", liobn); + error_report("Attempted to create TCE table with duplicate" + " LIOBN 0x%x", liobn); return NULL; } =20 Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr_rtas.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr_rtas.c +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr_rtas.c @@ -27,6 +27,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "qemu/log.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "sysemu/char.h" #include "hw/qdev.h" @@ -716,7 +717,7 @@ int spapr_rtas_device_tree_setup(void *f =20 ret =3D fdt_add_mem_rsv(fdt, rtas_addr, rtas_size); if (ret < 0) { - fprintf(stderr, "Couldn't add RTAS reserve entry: %s\n", + error_report("Couldn't add RTAS reserve entry: %s", fdt_strerror(ret)); return ret; } @@ -724,7 +725,7 @@ int spapr_rtas_device_tree_setup(void *f ret =3D qemu_fdt_setprop_cell(fdt, "/rtas", "linux,rtas-base", rtas_addr); if (ret < 0) { - fprintf(stderr, "Couldn't add linux,rtas-base property: %s\n", + error_report("Couldn't add linux,rtas-base property: %s", fdt_strerror(ret)); return ret; } @@ -732,7 +733,7 @@ int spapr_rtas_device_tree_setup(void *f ret =3D qemu_fdt_setprop_cell(fdt, "/rtas", "linux,rtas-entry", rtas_addr); if (ret < 0) { - fprintf(stderr, "Couldn't add linux,rtas-entry property: %s\n", + error_report("Couldn't add linux,rtas-entry property: %s", fdt_strerror(ret)); return ret; } @@ -740,7 +741,7 @@ int spapr_rtas_device_tree_setup(void *f ret =3D qemu_fdt_setprop_cell(fdt, "/rtas", "rtas-size", rtas_size); if (ret < 0) { - fprintf(stderr, "Couldn't add rtas-size property: %s\n", + error_report("Couldn't add rtas-size property: %s", fdt_strerror(ret)); return ret; } @@ -755,7 +756,7 @@ int spapr_rtas_device_tree_setup(void *f ret =3D qemu_fdt_setprop_cell(fdt, "/rtas", call->name, i + RTAS_TOKEN_BASE); if (ret < 0) { - fprintf(stderr, "Couldn't add rtas token for %s: %s\n", + error_report("Couldn't add rtas token for %s: %s", call->name, fdt_strerror(ret)); return ret; } @@ -770,7 +771,7 @@ int spapr_rtas_device_tree_setup(void *f ret =3D qemu_fdt_setprop(fdt, "/rtas", "ibm,lrdr-capacity", lrdr_cap= acity, sizeof(lrdr_capacity)); if (ret < 0) { - fprintf(stderr, "Couldn't add ibm,lrdr-capacity rtas property\n"= ); + error_report("Couldn't add ibm,lrdr-capacity rtas property"); return ret; } =20 Index: qemu-dgibson-for-2.8.git/hw/ppc/spapr_vio.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu-dgibson-for-2.8.git.orig/hw/ppc/spapr_vio.c +++ qemu-dgibson-for-2.8.git/hw/ppc/spapr_vio.c @@ -20,6 +20,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "qemu/log.h" @@ -276,7 +277,7 @@ int spapr_vio_send_crq(VIOsPAPRDevice *d uint8_t byte; =20 if (!dev->crq.qsize) { - fprintf(stderr, "spapr_vio_send_creq on uninitialized queue\n"); + error_report("spapr_vio_send_creq on uninitialized queue"); return -1; } =20 Index: qemu-dgibson-for-2.8.git/include/hw/ppc/fdt.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- qemu-dgibson-for-2.8.git.orig/include/hw/ppc/fdt.h +++ qemu-dgibson-for-2.8.git/include/hw/ppc/fdt.h @@ -10,11 +10,13 @@ #ifndef PPC_FDT_H #define PPC_FDT_H =20 -#define _FDT(exp) \ - do { \ +#include "qemu/error-report.h" + +#define _FDT(exp) \ + do { \ int ret =3D (exp); \ if (ret < 0) { \ - fprintf(stderr, "qemu: error creating device tree: %s: %s\n"= , \ + error_report("error creating device tree: %s: %s", \ #exp, fdt_strerror(ret)); \ exit(1); \ } \