aboutsummaryrefslogtreecommitdiff
path: root/hw/input/pckbd.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-04-27 22:18:47 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-29 08:27:48 -0500
commita2e0b863ebec1c9ceea9b7aab022a6378ea74136 (patch)
treea5c42498eaa4d3c61cfdb77b2cb3cfca9ea6a173 /hw/input/pckbd.c
parenta0881c64081f750be2e44a9b7000e18e4cea065e (diff)
pckbd: QOM'ify
Introduce type constant and cast macro to obsolete DO_UPCAST(). Prepares for ISA realizefn. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367093935-29091-13-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/input/pckbd.c')
-rw-r--r--hw/input/pckbd.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 08ceb9fe8a..17a56140de 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -431,8 +431,12 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
qemu_register_reset(kbd_reset, s);
}
+#define TYPE_I8042 "i8042"
+#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
+
typedef struct ISAKBDState {
- ISADevice dev;
+ ISADevice parent_obj;
+
KBDState kbd;
MemoryRegion io[2];
} ISAKBDState;
@@ -440,14 +444,16 @@ typedef struct ISAKBDState {
void i8042_isa_mouse_fake_event(void *opaque)
{
ISADevice *dev = opaque;
- KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd);
+ ISAKBDState *isa = I8042(dev);
+ KBDState *s = &isa->kbd;
ps2_mouse_fake_event(s->mouse);
}
void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out)
{
- KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd);
+ ISAKBDState *isa = I8042(dev);
+ KBDState *s = &isa->kbd;
s->a20_out = a20_out;
}
@@ -485,7 +491,7 @@ static const MemoryRegionOps i8042_cmd_ops = {
static int i8042_initfn(ISADevice *dev)
{
- ISAKBDState *isa_s = DO_UPCAST(ISAKBDState, dev, dev);
+ ISAKBDState *isa_s = I8042(dev);
KBDState *s = &isa_s->kbd;
isa_init_irq(dev, &s->irq_kbd, 1);
@@ -513,7 +519,7 @@ static void i8042_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo i8042_info = {
- .name = "i8042",
+ .name = TYPE_I8042,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(ISAKBDState),
.class_init = i8042_class_initfn,