From nobody Mon Feb 9 02:09:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496717769539766.42264165296; Mon, 5 Jun 2017 19:56:09 -0700 (PDT) Received: from localhost ([::1]:35965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI4f9-0007VO-M8 for importer@patchew.org; Mon, 05 Jun 2017 22:56:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI4aw-0003Us-UZ for qemu-devel@nongnu.org; Mon, 05 Jun 2017 22:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dI4at-0002wu-RJ for qemu-devel@nongnu.org; Mon, 05 Jun 2017 22:51:46 -0400 Received: from ozlabs.org ([103.22.144.67]:46261) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dI4at-0002vv-Dv; Mon, 05 Jun 2017 22:51:43 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3whbmp713nz9s78; Tue, 6 Jun 2017 12:51:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1496717498; bh=FjkiDlfZl1VgJuDKiH9FCtI72t5UJl+5/ZKJur/WbWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxJSlELg54sEOPP8mEb+1KHQrNSh7nxA4aUu2CehzR0qGxCsye0de6quU0Binp2Nk +4vMLmwYlbyqE6yZmJvUhVS2/C/XLrGPngtJtBN/xxl4DnKVrAjXXEzrvsKdTd/UNf ynf+aCkyCb3HfCBSdTcRWRzNMhTHEgukd785gumo= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 6 Jun 2017 12:51:22 +1000 Message-Id: <20170606025135.2685-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170606025135.2685-1-david@gibson.dropbear.id.au> References: <20170606025135.2685-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 04/17] spapr: Abolish DRC get_fdt method X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mdroth@linux.vnet.ibm.com, David Gibson , qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Laurent Vivier Reviewed-by: Greg Kurz Tested-by: Daniel Barboza --- 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; } =20 -static const void *get_fdt(sPAPRDRConnector *drc, int *fdt_start_offset) -{ - if (fdt_start_offset) { - *fdt_start_offset =3D 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 =3D get_index; drck->get_type =3D get_type; drck->get_name =3D get_name; - drck->get_fdt =3D get_fdt; drck->set_configured =3D set_configured; drck->entity_sense =3D entity_sense; drck->attach =3D attach; @@ -1126,7 +1117,6 @@ static void rtas_ibm_configure_connector(PowerPCCPU *= cpu, sPAPRConfigureConnectorState *ccs; sPAPRDRCCResponse resp =3D SPAPR_DR_CC_RESPONSE_CONTINUE; int rc; - const void *fdt; =20 if (nargs !=3D 2 || nret !=3D 1) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); @@ -1144,8 +1134,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU *= cpu, } =20 drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); - fdt =3D drck->get_fdt(drc, NULL); - if (!fdt) { + if (!drc->fdt) { trace_spapr_rtas_ibm_configure_connector_missing_fdt(drc_index); rc =3D SPAPR_DR_CC_RESPONSE_NOT_CONFIGURABLE; goto out; @@ -1154,7 +1143,7 @@ static void rtas_ibm_configure_connector(PowerPCCPU *= cpu, ccs =3D spapr_ccs_find(spapr, drc_index); if (!ccs) { ccs =3D g_new0(sPAPRConfigureConnectorState, 1); - (void)drck->get_fdt(drc, &ccs->fdt_offset); + ccs->fdt_offset =3D drc->fdt_start_offset; ccs->drc_index =3D 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; =20 - tag =3D fdt_next_tag(fdt, ccs->fdt_offset, &fdt_offset_next); + tag =3D fdt_next_tag(drc->fdt, ccs->fdt_offset, &fdt_offset_next); =20 switch (tag) { case FDT_BEGIN_NODE: ccs->fdt_depth++; - name =3D fdt_get_name(fdt, ccs->fdt_offset, NULL); + name =3D fdt_get_name(drc->fdt, ccs->fdt_offset, NULL); =20 /* provide the name of the next OF node */ wa_offset =3D CC_VAL_DATA_OFFSET; @@ -1193,9 +1182,9 @@ static void rtas_ibm_configure_connector(PowerPCCPU *= cpu, } break; case FDT_PROP: - prop =3D fdt_get_property_by_offset(fdt, ccs->fdt_offset, + prop =3D fdt_get_property_by_offset(drc->fdt, ccs->fdt_offset, &prop_len); - name =3D fdt_string(fdt, fdt32_to_cpu(prop->nameoff)); + name =3D fdt_string(drc->fdt, fdt32_to_cpu(prop->nameoff)); =20 /* provide the name of the next OF property */ wa_offset =3D 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 *st= ate); =20 /* QEMU interfaces for managing FDT/configure-connector */ - const void *(*get_fdt)(sPAPRDRConnector *drc, int *fdt_start_offset); void (*set_configured)(sPAPRDRConnector *drc); =20 /* QEMU interfaces for managing hotplug operations */ --=20 2.9.4