diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2017-06-01 10:36:24 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-06-06 08:53:24 +1000 |
commit | 88af6ea5687b1fdad47dad44eb9ff67c459c7dcc (patch) | |
tree | 33b980224c4ab8a41e7fdf39a8a7f99d8bdadf20 /hw/ppc/spapr_drc.c | |
parent | b89b3d39299559bc7bf7030e55f99c75dab70b2b (diff) |
spapr: Abolish DRC get_fdt method
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: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Daniel Barboza <danielhb@linux.vnet.ibm.com>
Diffstat (limited to 'hw/ppc/spapr_drc.c')
-rw-r--r-- | hw/ppc/spapr_drc.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index ae8800da23..f5b7b68090 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; |