@@ -676,7 +676,7 @@ void cpu_reset(CPUState *cpu);
*
* Returns: A #CPUClass or %NULL if not matching class is found.
*/
-ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model);
+CPUClass *cpu_class_by_name(const char *typename, const char *cpu_model);
/**
* cpu_create:
@@ -984,7 +984,6 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
const char *parse_cpu_option(const char *cpu_option)
{
- ObjectClass *oc;
CPUClass *cc;
gchar **model_pieces;
const char *cpu_type;
@@ -995,15 +994,14 @@ const char *parse_cpu_option(const char *cpu_option)
exit(1);
}
- oc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
- if (oc == NULL) {
+ cc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
+ if (cc == NULL) {
error_report("unable to find CPU model '%s'", model_pieces[0]);
g_strfreev(model_pieces);
exit(EXIT_FAILURE);
}
- cpu_type = object_class_get_name(oc);
- cc = CPU_CLASS(oc);
+ cpu_type = object_class_get_name(OBJECT_CLASS(cc));
cc->parse_features(cpu_type, model_pieces[1], &error_fatal);
g_strfreev(model_pieces);
return cpu_type;
@@ -283,12 +283,12 @@ static bool cpu_common_has_work(CPUState *cs)
return false;
}
-ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
+CPUClass *cpu_class_by_name(const char *typename, const char *cpu_model)
{
CPUClass *cc = CPU_CLASS(object_class_by_name(typename));
assert(cpu_model && cc->class_by_name);
- return cc->class_by_name(cpu_model);
+ return CPU_CLASS(cc->class_by_name(cpu_model));
}
static void cpu_common_parse_features(const char *typename, char *features,
@@ -482,7 +482,7 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
const QDict *qdict = NULL;
const QDictEntry *e;
Visitor *visitor;
- ObjectClass *oc;
+ CPUClass *cc;
S390CPU *cpu;
Object *obj;
@@ -494,16 +494,16 @@ static void cpu_model_from_info(S390CPUModel *model, const CpuModelInfo *info,
}
}
- oc = cpu_class_by_name(TYPE_S390_CPU, info->name);
- if (!oc) {
+ cc = cpu_class_by_name(TYPE_S390_CPU, info->name);
+ if (!cc) {
error_setg(errp, "The CPU definition \'%s\' is unknown.", info->name);
return;
}
- if (S390_CPU_CLASS(oc)->kvm_required && !kvm_enabled()) {
+ if (S390_CPU_CLASS(cc)->kvm_required && !kvm_enabled()) {
error_setg(errp, "The CPU definition '%s' requires KVM", info->name);
return;
}
- obj = object_new(object_class_get_name(oc));
+ obj = object_new(object_class_get_name(OBJECT_CLASS(cc)));
cpu = S390_CPU(obj);
if (!cpu->model) {
The function always returns a CPU class. Change the return type to reflect that. I'm not changing the return type of CPUClass::class_by_name() yet, because many of its implementations will be eliminated by the next commits. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- Cc: Cornelia Huck <cohuck@redhat.com> Cc: David Hildenbrand <david@redhat.com> Cc: qemu-s390x@nongnu.org Cc: Markus Armbruster <armbru@redhat.com> --- include/qom/cpu.h | 2 +- exec.c | 8 +++----- qom/cpu.c | 4 ++-- target/s390x/cpu_models.c | 10 +++++----- 4 files changed, 11 insertions(+), 13 deletions(-)