From: Peter Crosthwaite <peter.crosthwa...@xilinx.com> ARMCPUClass is only needed for parent-class abstract function access. Just use parent classes for reset and realize access and remove ARMCPUClass completely.
Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> --- target-arm/cpu-qom.h | 22 ++-------------------- target-arm/cpu.c | 14 +++++--------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index 48ba605..afc569e 100644 --- a/target-arm/cpu-qom.h +++ b/target-arm/cpu-qom.h @@ -24,28 +24,10 @@ #define TYPE_ARM_CPU "arm-cpu" -#define ARM_CPU_CLASS(klass) \ - OBJECT_CLASS_CHECK(ARMCPUClass, (klass), TYPE_ARM_CPU) #define ARM_CPU(obj) \ OBJECT_CHECK(ARMCPU, (obj), TYPE_ARM_CPU) -#define ARM_CPU_GET_CLASS(obj) \ - OBJECT_GET_CLASS(ARMCPUClass, (obj), TYPE_ARM_CPU) - -/** - * ARMCPUClass: - * @parent_realize: The parent class' realize handler. - * @parent_reset: The parent class' reset handler. - * - * An ARM CPU model. - */ -typedef struct ARMCPUClass { - /*< private >*/ - CPUClass parent_class; - /*< public >*/ - - DeviceRealize parent_realize; - void (*parent_reset)(CPUState *cpu); -} ARMCPUClass; +#define ARM_CPU_PARENT_CLASS \ + object_class_get_parent(object_class_by_name(TYPE_ARM_CPU)) /** * ARMCPU: diff --git a/target-arm/cpu.c b/target-arm/cpu.c index c2e1800..933e6b1 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -60,10 +60,10 @@ static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque) static void arm_cpu_reset(CPUState *s) { ARMCPU *cpu = ARM_CPU(s); - ARMCPUClass *acc = ARM_CPU_GET_CLASS(cpu); + CPUClass *cc_parent = CPU_CLASS(ARM_CPU_PARENT_CLASS); CPUARMState *env = &cpu->env; - acc->parent_reset(s); + cc_parent->reset(s); memset(env, 0, offsetof(CPUARMState, breakpoints)); g_hash_table_foreach(cpu->cp_regs, cp_reg_reset, cpu); @@ -153,7 +153,7 @@ static void arm_cpu_finalizefn(Object *obj) static void arm_cpu_realizefn(DeviceState *dev, Error **errp) { ARMCPU *cpu = ARM_CPU(dev); - ARMCPUClass *acc = ARM_CPU_GET_CLASS(dev); + DeviceClass *dc_parent = DEVICE_CLASS(ARM_CPU_PARENT_CLASS); CPUARMState *env = &cpu->env; /* Some features automatically imply others: */ @@ -204,7 +204,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) cpu_reset(CPU(cpu)); - acc->parent_realize(dev, errp); + dc_parent->realize(dev, errp); } /* CPU models */ @@ -798,14 +798,11 @@ static const ARMCPUInfo arm_cpus[] = { static void arm_cpu_class_init(ObjectClass *oc, void *data) { - ARMCPUClass *acc = ARM_CPU_CLASS(oc); - CPUClass *cc = CPU_CLASS(acc); + CPUClass *cc = CPU_CLASS(oc); DeviceClass *dc = DEVICE_CLASS(oc); - acc->parent_realize = dc->realize; dc->realize = arm_cpu_realizefn; - acc->parent_reset = cc->reset; cc->reset = arm_cpu_reset; cc->class_by_name = arm_cpu_class_by_name; @@ -834,7 +831,6 @@ static const TypeInfo arm_cpu_type_info = { .instance_init = arm_cpu_initfn, .instance_finalize = arm_cpu_finalizefn, .abstract = true, - .class_size = sizeof(ARMCPUClass), .class_init = arm_cpu_class_init, }; -- 1.8.3.rc1.44.gb387c77.dirty