All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: mdroth@linux.vnet.ibm.com, lvivier@redhat.com,
	sursingh@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	bharata@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/4] spapr: Abolish DRC get_fdt method
Date: Thu, 1 Jun 2017 18:09:12 +0200	[thread overview]
Message-ID: <20170601180912.4e24d6e0@bahia.lan> (raw)
In-Reply-To: <20170601015218.9299-3-david@gibson.dropbear.id.au>

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

On Thu,  1 Jun 2017 11:52:16 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> The DRConnectorClass includes a get_fdt method.  However
>   * There's only one implementation, and there's only likely to ever be one
>   * Both callers are local to spapr_drc
>   * Each caller only uses one half of the actual implementation
> 
> So abolish get_fdt() entirely, and just open-code what we need.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/ppc/spapr_drc.c         | 23 ++++++-----------------
>  include/hw/ppc/spapr_drc.h |  1 -
>  2 files changed, 6 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
> index ae8800d..f5b7b68 100644
> --- a/hw/ppc/spapr_drc.c
> +++ b/hw/ppc/spapr_drc.c
> @@ -199,14 +199,6 @@ static const char *get_name(sPAPRDRConnector *drc)
>      return drc->name;
>  }
>  
> -static const void *get_fdt(sPAPRDRConnector *drc, int *fdt_start_offset)
> -{
> -    if (fdt_start_offset) {
> -        *fdt_start_offset = drc->fdt_start_offset;
> -    }
> -    return drc->fdt;
> -}
> -
>  static void set_configured(sPAPRDRConnector *drc)
>  {
>      trace_spapr_drc_set_configured(get_index(drc));
> @@ -753,7 +745,6 @@ static void spapr_dr_connector_class_init(ObjectClass *k, void *data)
>      drck->get_index = get_index;
>      drck->get_type = get_type;
>      drck->get_name = get_name;
> -    drck->get_fdt = get_fdt;
>      drck->set_configured = set_configured;
>      drck->entity_sense = entity_sense;
>      drck->attach = attach;
> @@ -1126,7 +1117,6 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu,
>      sPAPRConfigureConnectorState *ccs;
>      sPAPRDRCCResponse resp = SPAPR_DR_CC_RESPONSE_CONTINUE;
>      int rc;
> -    const void *fdt;
>  
>      if (nargs != 2 || nret != 1) {
>          rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
> @@ -1144,8 +1134,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu,
>      }
>  
>      drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
> -    fdt = drck->get_fdt(drc, NULL);
> -    if (!fdt) {
> +    if (!drc->fdt) {
>          trace_spapr_rtas_ibm_configure_connector_missing_fdt(drc_index);
>          rc = SPAPR_DR_CC_RESPONSE_NOT_CONFIGURABLE;
>          goto out;
> @@ -1154,7 +1143,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu,
>      ccs = spapr_ccs_find(spapr, drc_index);
>      if (!ccs) {
>          ccs = g_new0(sPAPRConfigureConnectorState, 1);
> -        (void)drck->get_fdt(drc, &ccs->fdt_offset);
> +        ccs->fdt_offset = drc->fdt_start_offset;
>          ccs->drc_index = drc_index;
>          spapr_ccs_add(spapr, ccs);
>      }
> @@ -1165,12 +1154,12 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu,
>          const struct fdt_property *prop;
>          int fdt_offset_next, prop_len;
>  
> -        tag = fdt_next_tag(fdt, ccs->fdt_offset, &fdt_offset_next);
> +        tag = fdt_next_tag(drc->fdt, ccs->fdt_offset, &fdt_offset_next);
>  
>          switch (tag) {
>          case FDT_BEGIN_NODE:
>              ccs->fdt_depth++;
> -            name = fdt_get_name(fdt, ccs->fdt_offset, NULL);
> +            name = fdt_get_name(drc->fdt, ccs->fdt_offset, NULL);
>  
>              /* provide the name of the next OF node */
>              wa_offset = CC_VAL_DATA_OFFSET;
> @@ -1193,9 +1182,9 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu,
>              }
>              break;
>          case FDT_PROP:
> -            prop = fdt_get_property_by_offset(fdt, ccs->fdt_offset,
> +            prop = fdt_get_property_by_offset(drc->fdt, ccs->fdt_offset,
>                                                &prop_len);
> -            name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
> +            name = fdt_string(drc->fdt, fdt32_to_cpu(prop->nameoff));
>  
>              /* provide the name of the next OF property */
>              wa_offset = CC_VAL_DATA_OFFSET;
> diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
> index 813b9ff..80db955 100644
> --- a/include/hw/ppc/spapr_drc.h
> +++ b/include/hw/ppc/spapr_drc.h
> @@ -178,7 +178,6 @@ typedef struct sPAPRDRConnectorClass {
>      uint32_t (*entity_sense)(sPAPRDRConnector *drc, sPAPRDREntitySense *state);
>  
>      /* QEMU interfaces for managing FDT/configure-connector */
> -    const void *(*get_fdt)(sPAPRDRConnector *drc, int *fdt_start_offset);
>      void (*set_configured)(sPAPRDRConnector *drc);
>  
>      /* QEMU interfaces for managing hotplug operations */


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  parent reply	other threads:[~2017-06-01 16:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01  1:52 [Qemu-devel] [PATCH 0/4] spapr:DRC cleanups (part I) David Gibson
2017-06-01  1:52 ` [Qemu-devel] [PATCH 1/4] spapr: Move DRC RTAS calls into spapr_drc.c David Gibson
2017-06-01 13:36   ` Laurent Vivier
2017-06-01 16:05     ` Michael Roth
2017-06-02  3:21       ` David Gibson
2017-06-01 15:56   ` Michael Roth
2017-06-02  3:24     ` David Gibson
2017-06-01 16:08   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-06-01  1:52 ` [Qemu-devel] [PATCH 2/4] spapr: Abolish DRC get_fdt method David Gibson
2017-06-01 14:01   ` Laurent Vivier
2017-06-01 16:09   ` Greg Kurz [this message]
2017-06-01  1:52 ` [Qemu-devel] [PATCH 3/4] spapr: Abolish DRC set_configured method David Gibson
2017-06-01 15:13   ` Laurent Vivier
2017-06-01 15:37   ` Michael Roth
2017-06-02  3:31     ` David Gibson
2017-06-01 16:14   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-06-01  1:52 ` [Qemu-devel] [PATCH 4/4] spapr: Make DRC get_index and get_type methods into plain functions David Gibson
2017-06-01 15:19   ` Laurent Vivier
2017-06-01  4:06 ` [Qemu-devel] [PATCH 0/4] spapr:DRC cleanups (part I) Bharata B Rao
2017-06-01  4:21   ` David Gibson
2017-06-01  4:25   ` Michael Roth
2017-06-01  5:30     ` David Gibson
2017-06-01 15:41       ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2017-06-02  3:35         ` David Gibson
2017-06-01 13:41 ` Daniel Henrique Barboza
2017-06-02  3:49 ` [Qemu-devel] " 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=20170601180912.4e24d6e0@bahia.lan \
    --to=groug@kaod.org \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sursingh@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.