From patchwork Thu May 23 05:29:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 10956905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E3BD112C for ; Thu, 23 May 2019 05:34:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33D7627FA8 for ; Thu, 23 May 2019 05:34:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276FD27FB7; Thu, 23 May 2019 05:34:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9925227FA8 for ; Thu, 23 May 2019 05:34:17 +0000 (UTC) Received: from localhost ([127.0.0.1]:57956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTgMq-0003IK-Uw for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 May 2019 01:34:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTgIK-00080F-PI for qemu-devel@nongnu.org; Thu, 23 May 2019 01:29:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTgII-0005hU-P7 for qemu-devel@nongnu.org; Thu, 23 May 2019 01:29:36 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:46377 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTgIG-0005eq-Sy; Thu, 23 May 2019 01:29:34 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 458dNM1cfDz9sBV; Thu, 23 May 2019 15:29:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1558589363; bh=wlcVpy0sbRd29hFk1MbdfxHd4sEwdHTcHO9jwTKHELc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ll88wXPaUY6Y0K9apcMfZbHyPEhPOulAbUL9qLVLSFukOqLYuCwigRelOw8vSEKgK f3qTh2pTxibYeowkPzOglxTJ2q9rMGsgfq3RBqAb7FjlSudHnvUPPuoP/bOPu7Pj0X Ry4lfljL8Zs0Q/UfeQqew6eM30sdpRmeO6L2GssI= From: David Gibson To: qemu-ppc@nongnu.org Date: Thu, 23 May 2019 15:29:14 +1000 Message-Id: <20190523052918.1129-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523052918.1129-1-david@gibson.dropbear.id.au> References: <20190523052918.1129-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PATCH 4/8] spapr: Clean up spapr_drc_populate_dt() 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: mst@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, clg@kaod.org, mdroth@linux.ibm.com, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This makes some minor cleanups to spapr_drc_populate_dt(), renaming it to the shorter and more idiomatic spapr_dt_drc() along the way. Signed-off-by: David Gibson Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 7 +++---- hw/ppc/spapr_drc.c | 13 ++++++------- hw/ppc/spapr_pci.c | 3 +-- include/hw/ppc/spapr_drc.h | 3 +-- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 44573adce7..507fd50dd5 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1320,13 +1320,12 @@ static void *spapr_build_fdt(SpaprMachineState *spapr) spapr_populate_cpus_dt_node(fdt, spapr); if (smc->dr_lmb_enabled) { - _FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB)); + _FDT(spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB)); } if (mc->has_hotpluggable_cpus) { int offset = fdt_path_offset(fdt, "/cpus"); - ret = spapr_drc_populate_dt(fdt, offset, NULL, - SPAPR_DR_CONNECTOR_TYPE_CPU); + ret = spapr_dt_drc(fdt, offset, NULL, SPAPR_DR_CONNECTOR_TYPE_CPU); if (ret < 0) { error_report("Couldn't set up CPU DR device tree properties"); exit(1); @@ -1363,7 +1362,7 @@ static void *spapr_build_fdt(SpaprMachineState *spapr) } if (smc->dr_phb_enabled) { - ret = spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB); + ret = spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB); if (ret < 0) { error_report("Couldn't set up PHB DR device tree properties"); exit(1); diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 597f236b9c..bacadfcac5 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -781,7 +781,7 @@ SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id) } /** - * spapr_drc_populate_dt + * spapr_dt_drc * * @fdt: libfdt device tree * @path: path in the DT to generate properties @@ -794,8 +794,7 @@ SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id) * * as documented in PAPR+ v2.1, 13.5.2 */ -int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, - uint32_t drc_type_mask) +int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask) { Object *root_container; ObjectProperty *prop; @@ -873,7 +872,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, *(uint32_t *)drc_names->str = cpu_to_be32(drc_count); *(uint32_t *)drc_types->str = cpu_to_be32(drc_count); - ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-indexes", + ret = fdt_setprop(fdt, offset, "ibm,drc-indexes", drc_indexes->data, drc_indexes->len * sizeof(uint32_t)); if (ret) { @@ -881,7 +880,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, goto out; } - ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-power-domains", + ret = fdt_setprop(fdt, offset, "ibm,drc-power-domains", drc_power_domains->data, drc_power_domains->len * sizeof(uint32_t)); if (ret) { @@ -889,14 +888,14 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, goto out; } - ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-names", + ret = fdt_setprop(fdt, offset, "ibm,drc-names", drc_names->str, drc_names->len); if (ret) { error_report("Couldn't finalize ibm,drc-names property"); goto out; } - ret = fdt_setprop(fdt, fdt_offset, "ibm,drc-types", + ret = fdt_setprop(fdt, offset, "ibm,drc-types", drc_types->str, drc_types->len); if (ret) { error_report("Couldn't finalize ibm,drc-types property"); diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index c166df4145..04855d3125 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2282,8 +2282,7 @@ int spapr_dt_phb(SpaprPhbState *phb, uint32_t intc_phandle, void *fdt, return ret; } - ret = spapr_drc_populate_dt(fdt, bus_off, OBJECT(phb), - SPAPR_DR_CONNECTOR_TYPE_PCI); + ret = spapr_dt_drc(fdt, bus_off, OBJECT(phb), SPAPR_DR_CONNECTOR_TYPE_PCI); if (ret) { return ret; } diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h index fad0a887f9..c2c543a591 100644 --- a/include/hw/ppc/spapr_drc.h +++ b/include/hw/ppc/spapr_drc.h @@ -266,8 +266,7 @@ SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, uint32_t id); SpaprDrc *spapr_drc_by_index(uint32_t index); SpaprDrc *spapr_drc_by_id(const char *type, uint32_t id); -int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, - uint32_t drc_type_mask); +int spapr_dt_drc(void *fdt, int offset, Object *owner, uint32_t drc_type_mask); void spapr_drc_attach(SpaprDrc *drc, DeviceState *d, Error **errp); void spapr_drc_detach(SpaprDrc *drc);