qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] hw/ppc: include fdt helper routine in a common file
Date: Tue, 26 Jul 2016 15:57:12 +1000	[thread overview]
Message-ID: <20160726055712.GJ17429@voom.fritz.box> (raw)
In-Reply-To: <1469456683-25891-2-git-send-email-clg@kaod.org>

[-- Attachment #1: Type: text/plain, Size: 4250 bytes --]

On Mon, Jul 25, 2016 at 04:24:41PM +0200, Cédric Le Goater wrote:
> spapr_pci would also be a good candidate but the macro _FDT is
> slightly different. It returns and does not exit.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

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
> 
> 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"
>  
> +#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;
>  }
>  
> -#define _FDT(exp) \
> -    do { \
> -        int ret = (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"
>  
> +#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
>  
> -#define _FDT(exp) \
> -    do { \
> -        int ret = (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[] = {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 = (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 */

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-07-26  6:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 14:24 [Qemu-devel] [PATCH 0/3] Add PowerNV skeleton Cédric Le Goater
2016-07-25 14:24 ` [Qemu-devel] [PATCH 1/3] hw/ppc: include fdt helper routine in a common file Cédric Le Goater
2016-07-26  5:57   ` David Gibson [this message]
2016-07-25 14:24 ` [Qemu-devel] [PATCH 2/3] hw/ppc: use error_report instead of fprintf Cédric Le Goater
2016-07-26  5:58   ` David Gibson
2016-07-26  6:29     ` Cédric Le Goater
2016-07-25 14:24 ` [Qemu-devel] [PATCH 3/3] ppc/pnv: Add skeletton PowerNV platform Cédric Le Goater
2016-07-26  6:23   ` David Gibson
2016-07-28 17:27     ` Cédric Le Goater
2016-07-29  3:32       ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160726055712.GJ17429@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=clg@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).