From nobody Thu Nov 6 01:14:56 2025 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.zohomail.com; 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 1539241379675216.45764842982408; Thu, 11 Oct 2018 00:02:59 -0700 (PDT) Received: from localhost ([::1]:60848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAUzf-0003ax-6Q for importer@patchew.org; Thu, 11 Oct 2018 03:02:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAUyc-0003Ca-IE for qemu-devel@nongnu.org; Thu, 11 Oct 2018 03:01:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAUxk-000748-Ad for qemu-devel@nongnu.org; Thu, 11 Oct 2018 03:01:42 -0400 Received: from 16.mo5.mail-out.ovh.net ([87.98.174.144]:59447) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gAUxk-00073V-2X for qemu-devel@nongnu.org; Thu, 11 Oct 2018 03:00:48 -0400 Received: from player796.ha.ovh.net (unknown [10.109.160.239]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id E64741F91B8 for ; Thu, 11 Oct 2018 09:00:45 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player796.ha.ovh.net (Postfix) with ESMTPA id 8E3145C00B8; Thu, 11 Oct 2018 09:00:41 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2018 09:00:35 +0200 Message-ID: <153924123502.3669683.1365591120394690822.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 17662273314291423571 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrudejgdduudeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 87.98.174.144 Subject: [Qemu-devel] [PATCH] spapr_pci: rename some structured types 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: qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 According to CODING_STYLE, structured types names are expected to be in CamelCase. PCI is dropped from the name for better readability. While here, this also converts a call to g_malloc(n * sizeofi(foo)) to g_new(n, foo), which is a recommended good practice. Signed-off-by: Greg Kurz --- hw/ppc/spapr_pci.c | 22 +++++++++++----------- include/hw/pci-host/spapr.h | 12 ++++++------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index c2271e6ed462..bfb959f2b065 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -277,7 +277,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRM= achineState *spapr, unsigned int irq, max_irqs =3D 0; sPAPRPHBState *phb =3D NULL; PCIDevice *pdev =3D NULL; - spapr_pci_msi *msi; + sPAPRMSI *msi; int *config_addr_key; Error *err =3D NULL; int i; @@ -325,7 +325,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRM= achineState *spapr, return; } =20 - msi =3D (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr); + msi =3D (sPAPRMSI *) g_hash_table_lookup(phb->msi, &config_addr); =20 /* Releasing MSIs */ if (!req_num) { @@ -414,7 +414,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRM= achineState *spapr, irq, req_num); =20 /* Add MSI device to cache */ - msi =3D g_new(spapr_pci_msi, 1); + msi =3D g_new(sPAPRMSI, 1); msi->first_irq =3D irq; msi->num =3D req_num; config_addr_key =3D g_new(int, 1); @@ -445,7 +445,7 @@ static void rtas_ibm_query_interrupt_source_number(Powe= rPCCPU *cpu, unsigned int intr_src_num =3D -1, ioa_intr_num =3D rtas_ld(args, 3); sPAPRPHBState *phb =3D NULL; PCIDevice *pdev =3D NULL; - spapr_pci_msi *msi; + sPAPRMSI *msi; =20 /* Find sPAPRPHBState */ phb =3D spapr_pci_find_phb(spapr, buid); @@ -458,7 +458,7 @@ static void rtas_ibm_query_interrupt_source_number(Powe= rPCCPU *cpu, } =20 /* Find device descriptor and start IRQ */ - msi =3D (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr); + msi =3D (sPAPRMSI *) g_hash_table_lookup(phb->msi, &config_addr); if (!msi || !msi->first_irq || !msi->num || (ioa_intr_num >=3D msi->nu= m)) { trace_spapr_pci_msi("Failed to return vector", config_addr); rtas_st(rets, 0, RTAS_OUT_HW_ERROR); @@ -1849,9 +1849,9 @@ static const VMStateDescription vmstate_spapr_pci_msi= =3D { .version_id =3D 1, .minimum_version_id =3D 1, .fields =3D (VMStateField []) { - VMSTATE_UINT32(key, spapr_pci_msi_mig), - VMSTATE_UINT32(value.first_irq, spapr_pci_msi_mig), - VMSTATE_UINT32(value.num, spapr_pci_msi_mig), + VMSTATE_UINT32(key, sPAPRMSIMig), + VMSTATE_UINT32(value.first_irq, sPAPRMSIMig), + VMSTATE_UINT32(value.num, sPAPRMSIMig), VMSTATE_END_OF_LIST() }, }; @@ -1883,12 +1883,12 @@ static int spapr_pci_pre_save(void *opaque) if (!sphb->msi_devs_num) { return 0; } - sphb->msi_devs =3D g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_= mig)); + sphb->msi_devs =3D g_new(sPAPRMSIMig, sphb->msi_devs_num); =20 g_hash_table_iter_init(&iter, sphb->msi); for (i =3D 0; g_hash_table_iter_next(&iter, &key, &value); ++i) { sphb->msi_devs[i].key =3D *(uint32_t *) key; - sphb->msi_devs[i].value =3D *(spapr_pci_msi *) value; + sphb->msi_devs[i].value =3D *(sPAPRMSI *) value; } =20 return 0; @@ -1938,7 +1938,7 @@ static const VMStateDescription vmstate_spapr_pci =3D= { vmstate_spapr_pci_lsi, struct spapr_pci_lsi), VMSTATE_INT32(msi_devs_num, sPAPRPHBState), VMSTATE_STRUCT_VARRAY_ALLOC(msi_devs, sPAPRPHBState, msi_devs_num,= 0, - vmstate_spapr_pci_msi, spapr_pci_msi_m= ig), + vmstate_spapr_pci_msi, sPAPRMSIMig), VMSTATE_END_OF_LIST() }, }; diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 7c66c3872f96..041126da573d 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -34,15 +34,15 @@ =20 typedef struct sPAPRPHBState sPAPRPHBState; =20 -typedef struct spapr_pci_msi { +typedef struct sPAPRMSI { uint32_t first_irq; uint32_t num; -} spapr_pci_msi; +} sPAPRMSI; =20 -typedef struct spapr_pci_msi_mig { +typedef struct sPAPRMSIMig { uint32_t key; - spapr_pci_msi value; -} spapr_pci_msi_mig; + sPAPRMSI value; +} sPAPRMSIMig; =20 struct sPAPRPHBState { PCIHostState parent_obj; @@ -70,7 +70,7 @@ struct sPAPRPHBState { GHashTable *msi; /* Temporary cache for migration purposes */ int32_t msi_devs_num; - spapr_pci_msi_mig *msi_devs; + sPAPRMSIMig *msi_devs; =20 QLIST_ENTRY(sPAPRPHBState) list; =20