[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/22] Revert "hw/ppc/spapr_pci.c: Avoid functions n
From: |
David Gibson |
Subject: |
[Qemu-devel] [PATCH 12/22] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)" |
Date: |
Wed, 24 Jun 2015 16:30:26 +1000 |
From: Markus Armbruster <address@hidden>
Since we now require GLib 2.22+ (commit f40685c), we don't have to
work around lack of g_hash_table_iter_init() & friends anymore.
This reverts commit f8833a37c0c6b22ddd57b45e48cfb0f97dbd5af4.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_pci.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 51196b5..dc4a683 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1362,34 +1362,28 @@ static const VMStateDescription vmstate_spapr_pci_msi =
{
},
};
-static void spapr_pci_fill_msi_devs(gpointer key, gpointer value,
- gpointer opaque)
-{
- sPAPRPHBState *sphb = opaque;
-
- sphb->msi_devs[sphb->msi_devs_num].key = *(uint32_t *)key;
- sphb->msi_devs[sphb->msi_devs_num].value = *(spapr_pci_msi *)value;
- sphb->msi_devs_num++;
-}
-
static void spapr_pci_pre_save(void *opaque)
{
sPAPRPHBState *sphb = opaque;
- int msi_devs_num;
+ GHashTableIter iter;
+ gpointer key, value;
+ int i;
if (sphb->msi_devs) {
g_free(sphb->msi_devs);
sphb->msi_devs = NULL;
}
- sphb->msi_devs_num = 0;
- msi_devs_num = g_hash_table_size(sphb->msi);
- if (!msi_devs_num) {
+ sphb->msi_devs_num = g_hash_table_size(sphb->msi);
+ if (!sphb->msi_devs_num) {
return;
}
- sphb->msi_devs = g_malloc(msi_devs_num * sizeof(spapr_pci_msi_mig));
+ sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));
- g_hash_table_foreach(sphb->msi, spapr_pci_fill_msi_devs, sphb);
- assert(sphb->msi_devs_num == msi_devs_num);
+ g_hash_table_iter_init(&iter, sphb->msi);
+ for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) {
+ sphb->msi_devs[i].key = *(uint32_t *) key;
+ sphb->msi_devs[i].value = *(spapr_pci_msi *) value;
+ }
}
static int spapr_pci_post_load(void *opaque, int version_id)
--
2.4.3
- [Qemu-devel] [PATCH 00/22] sPAPR updates 2015-06-24, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 10/22] spapr_iommu: drop erroneous check in h_put_tce_indirect(), David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 06/22] spapr: Add sPAPRMachineClass, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 11/22] spapr_iommu: translate sPAPRTCEAccess to IOMMUAccessFlags, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 07/22] spapr_pci: encode missing 64-bit memory address space, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 09/22] spapr_pci: set device node unit address as hex, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 14/22] spapr: Support ibm, lrdr-capacity device tree property, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 12/22] Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)",
David Gibson <=
- [Qemu-devel] [PATCH 13/22] spapr: Consider max_cpus during xics initialization, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 05/22] spapr: Remove obsolete entry_point field from sPAPRMachineState, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 04/22] spapr: Remove obsolete ram_limit field from sPAPRMachineState, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 08/22] spapr_pci: encode class code including Prog IF register, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 03/22] spapr: Merge sPAPREnvironment into sPAPRMachineState, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 02/22] pseries: Update SLOF firmware image to qemu-slof-20150429, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 01/22] spapr: ensure we have at least one XICS server, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 15/22] cpus: Add a macro to walk CPUs in reverse, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 17/22] spapr: Consolidate cpu init code into a routine, David Gibson, 2015/06/24
- [Qemu-devel] [PATCH 18/22] ppc: Update cpu_model in MachineState, David Gibson, 2015/06/24