From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRvlz-0007lT-IQ for qemu-devel@nongnu.org; Tue, 26 Jul 2016 02:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRvlu-0006Pd-IA for qemu-devel@nongnu.org; Tue, 26 Jul 2016 02:23:22 -0400 Date: Tue, 26 Jul 2016 15:57:12 +1000 From: David Gibson Message-ID: <20160726055712.GJ17429@voom.fritz.box> References: <1469456683-25891-1-git-send-email-clg@kaod.org> <1469456683-25891-2-git-send-email-clg@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aznLbwQ42o7LEaqN" Content-Disposition: inline In-Reply-To: <1469456683-25891-2-git-send-email-clg@kaod.org> Subject: Re: [Qemu-devel] [PATCH 1/3] hw/ppc: include fdt helper routine in a common file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: Alexander Graf , qemu-devel@nongnu.org, qemu-ppc@nongnu.org --aznLbwQ42o7LEaqN Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 25, 2016 at 04:24:41PM +0200, C=E9dric Le Goater wrote: > spapr_pci would also be a good candidate but the macro _FDT is > slightly different. It returns and does not exit. >=20 > Signed-off-by: C=E9dric Le Goater Ugh, I so want to get rid of that ugly macro. It may be a while before I have time to revisit my qdt cleanups though, so in the mentime we might as well have only one definition of the thing. Applied to ppc-for-2.8. > --- > hw/ppc/spapr.c | 11 +---------- > hw/ppc/spapr_events.c | 11 +---------- > include/hw/ppc/fdt.h | 23 +++++++++++++++++++++++ > 3 files changed, 25 insertions(+), 20 deletions(-) > create mode 100644 include/hw/ppc/fdt.h >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 9193ac2c122b..538ff5a46768 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -47,6 +47,7 @@ > #include "hw/ppc/ppc.h" > #include "hw/loader.h" > =20 > +#include "hw/ppc/fdt.h" > #include "hw/ppc/spapr.h" > #include "hw/ppc/spapr_vio.h" > #include "hw/pci-host/spapr.h" > @@ -299,16 +300,6 @@ static hwaddr spapr_node0_size(void) > return machine->ram_size; > } > =20 > -#define _FDT(exp) \ > - do { \ > - int ret =3D (exp); \ > - if (ret < 0) { \ > - fprintf(stderr, "qemu: error creating device tree: %s: %s\n"= , \ > - #exp, fdt_strerror(ret)); \ > - exit(1); \ > - } \ > - } while (0) > - > static void add_str(GString *s, const gchar *s1) > { > g_string_append_len(s, s1, strlen(s1) + 1); > diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c > index b0668b34a927..4c7b6aeab630 100644 > --- a/hw/ppc/spapr_events.c > +++ b/hw/ppc/spapr_events.c > @@ -32,6 +32,7 @@ > #include "hw/qdev.h" > #include "sysemu/device_tree.h" > =20 > +#include "hw/ppc/fdt.h" > #include "hw/ppc/spapr.h" > #include "hw/ppc/spapr_vio.h" > #include "hw/pci/pci.h" > @@ -210,16 +211,6 @@ struct hp_log_full { > #define EVENT_MASK_HOTPLUG 0x10000000 > #define EVENT_MASK_IO 0x08000000 > =20 > -#define _FDT(exp) \ > - do { \ > - int ret =3D (exp); \ > - if (ret < 0) { \ > - fprintf(stderr, "qemu: error creating device tree: %s: %s\n"= , \ > - #exp, fdt_strerror(ret)); \ > - exit(1); \ > - } \ > - } while (0) > - > void spapr_events_fdt_skel(void *fdt, uint32_t check_exception_irq) > { > uint32_t irq_ranges[] =3D {cpu_to_be32(check_exception_irq), cpu_to_= be32(1)}; > diff --git a/include/hw/ppc/fdt.h b/include/hw/ppc/fdt.h > new file mode 100644 > index 000000000000..fff3e1b57763 > --- /dev/null > +++ b/include/hw/ppc/fdt.h > @@ -0,0 +1,23 @@ > +/* > + * QEMU PowerPC helper routines for the device tree. > + * > + * Copyright (C) 2016 IBM Corp. > + * > + * This code is licensed under the GPL version 2 or later. See the > + * COPYING file in the top-level directory. > + */ > + > +#ifndef PPC_FDT_H > +#define PPC_FDT_H > + > +#define _FDT(exp) \ > + do { \ > + int ret =3D (exp); \ > + if (ret < 0) { \ > + fprintf(stderr, "qemu: error creating device tree: %s: %s\n"= , \ > + #exp, fdt_strerror(ret)); \ > + exit(1); \ > + } \ > + } while (0) > + > +#endif /* PPC_FDT_H */ --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --aznLbwQ42o7LEaqN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXlvu4AAoJEGw4ysog2bOSyIcP/i1dxLtLl2csld2jnee45yg0 dVHb5Sr9Vnv9WyGKbFVagxvCuS/71p9+Kf2AjL7FtUY1AkAPpirBp6mV6kYlsw0L swpxHCoEuu/PM+3ygD32EF3HDyev78IgJye1u3baB+SSZpBLpgHFPzKwPBXCuceU E2L4W+VpHydcMitmEBaHBepNfBoFuqKHTsPGPDzlvXKNIsKs/IrzX3pYpu+ecfAF N3+YU79JFjSytRubV8UHtFeLjm8WTs8LxBkCEGsJCM8la3AYqpt4IODJDCAMAgxL dCOVv1OJUcTvn2bHoS8kSINL2X5d3AdyJSVOjQPmkKf88vzGJuOumUu2I7AJe6NS +H4KbUYapECihydvWPOwDdULU4IrUc5BilNqZkj0Mt0norE1e7mNjHJP/LH9fmFw ffWigYG2pRnD+SuSRqGU5xum4LLrNm3yokaR54931fV7ULmQV+fiCe/hAXyzeddA HnmD6f6KiHeQj47kv/PvpwgnT84sJXbL/X85Rz2OFmBc9QGFRgsRvqdQny//U+Zw zF/9iuKy5Ny/5bkfXQn57v9BVxxTY+KgGj54W1vblDOv1bFxo/mgY7diTYKVQ2rI yGHnzx0vrcFs7St8AQabYxgOW38/ycVC/PruLYo/1QMiMjNQuklYSLruy3bBBHqt UJylj+I2LQzoKxGtuCX0 =nVzk -----END PGP SIGNATURE----- --aznLbwQ42o7LEaqN--