Revert "hw/ppc/spapr_pci.c: Avoid functions not in glib 2.12 (g_hash_table_iter_*)"
Since we now require GLib 2.22+ (commitf40685c
), we don't have to work around lack of g_hash_table_iter_init() & friends anymore. This reverts commitf8833a37c0
. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
5709af3b95
commit
708414f03c
|
@ -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)
|
static void spapr_pci_pre_save(void *opaque)
|
||||||
{
|
{
|
||||||
sPAPRPHBState *sphb = opaque;
|
sPAPRPHBState *sphb = opaque;
|
||||||
int msi_devs_num;
|
GHashTableIter iter;
|
||||||
|
gpointer key, value;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (sphb->msi_devs) {
|
if (sphb->msi_devs) {
|
||||||
g_free(sphb->msi_devs);
|
g_free(sphb->msi_devs);
|
||||||
sphb->msi_devs = NULL;
|
sphb->msi_devs = NULL;
|
||||||
}
|
}
|
||||||
sphb->msi_devs_num = 0;
|
sphb->msi_devs_num = g_hash_table_size(sphb->msi);
|
||||||
msi_devs_num = g_hash_table_size(sphb->msi);
|
if (!sphb->msi_devs_num) {
|
||||||
if (!msi_devs_num) {
|
|
||||||
return;
|
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);
|
g_hash_table_iter_init(&iter, sphb->msi);
|
||||||
assert(sphb->msi_devs_num == msi_devs_num);
|
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)
|
static int spapr_pci_post_load(void *opaque, int version_id)
|
||||||
|
|
Loading…
Reference in a new issue