|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 05/22] i8259.c: move parent_realize from PICClass to I8259CommonClass
Both the emulated and KVM i8259 implementations store a reference to the
parent_realize function in their respective classes. Start by moving
parent_realize from PICClass to I8259CommonClass and removing PICClass since
it is no longer required.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@xxxxxxxxxxx>
---
include/hw/isa/i8259_internal.h | 2 ++
hw/intc/i8259.c | 21 +++------------------
2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h
index e039d6f067..e2b0b00f5b 100644
--- a/include/hw/isa/i8259_internal.h
+++ b/include/hw/isa/i8259_internal.h
@@ -37,6 +37,8 @@ OBJECT_DECLARE_TYPE(I8259CommonState, I8259CommonClass,
I8259_COMMON)
struct I8259CommonClass {
DeviceClass parent_class;
+ DeviceRealize parent_realize;
+
void (*pre_save)(I8259CommonState *s);
void (*post_load)(I8259CommonState *s);
};
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index 547e86c5f4..131aaf9b04 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -35,19 +35,6 @@
/*#define DEBUG_IRQ_LATENCY*/
#define TYPE_I8259 "isa-i8259"
-typedef struct PICClass PICClass;
-DECLARE_CLASS_CHECKERS(PICClass, PIC,
- TYPE_I8259)
-
-/**
- * PICClass:
- * @parent_realize: The parent's realizefn.
- */
-struct PICClass {
- I8259CommonClass parent_class;
-
- DeviceRealize parent_realize;
-};
#ifdef DEBUG_IRQ_LATENCY
static int64_t irq_time[16];
@@ -388,7 +375,7 @@ static const MemoryRegionOps pic_elcr_ioport_ops = {
static void pic_realize(DeviceState *dev, Error **errp)
{
I8259CommonState *s = I8259_COMMON(dev);
- PICClass *pc = PIC_GET_CLASS(dev);
+ I8259CommonClass *k = I8259_COMMON_GET_CLASS(dev);
memory_region_init_io(&s->base_io, OBJECT(s), &pic_base_ioport_ops, s,
"pic", 2);
@@ -398,7 +385,7 @@ static void pic_realize(DeviceState *dev, Error **errp)
qdev_init_gpio_out(dev, s->int_out, ARRAY_SIZE(s->int_out));
qdev_init_gpio_in(dev, pic_set_irq, 8);
- pc->parent_realize(dev, errp);
+ k->parent_realize(dev, errp);
}
qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq_in)
@@ -435,7 +422,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq_in)
static void i8259_class_init(ObjectClass *klass, const void *data)
{
- PICClass *k = PIC_CLASS(klass);
+ I8259CommonClass *k = I8259_COMMON_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
device_class_set_parent_realize(dc, pic_realize, &k->parent_realize);
@@ -444,10 +431,8 @@ static void i8259_class_init(ObjectClass *klass, const
void *data)
static const TypeInfo i8259_info = {
.name = TYPE_I8259,
- .instance_size = sizeof(I8259CommonState),
.parent = TYPE_I8259_COMMON,
.class_init = i8259_class_init,
- .class_size = sizeof(PICClass),
};
static void pic_register_types(void)
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |