s390x/flic: cache flic in s390_get_flic

s390_get_flic() is called many times to obtain the flic. This wastes a
lot of time as it calls object_resolve_path() every time. Let's cache
S390FLICState by defining it as static.

Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
Fei Li 2017-03-17 10:28:30 +01:00 committed by Cornelia Huck
parent c572d3f313
commit bc66d6cbca

View File

@ -21,11 +21,14 @@
S390FLICState *s390_get_flic(void)
{
S390FLICState *fs;
static S390FLICState *fs;
if (!fs) {
fs = S390_FLIC_COMMON(object_resolve_path(TYPE_KVM_S390_FLIC, NULL));
if (!fs) {
fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC, NULL));
fs = S390_FLIC_COMMON(object_resolve_path(TYPE_QEMU_S390_FLIC,
NULL));
}
}
return fs;
}