diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-26 18:37:02 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:06:57 +0200 |
commit | 2a052f6bf11f00b358cf4e0abdd6e2cf59648a71 (patch) | |
tree | 3981d865b0c1583a72c66a3ea6aa56dfdb57549f /hw/input | |
parent | 93e7f5f42d0d3663acb94b24c8a9a329b5b13917 (diff) |
milkymist-softusb: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/input')
-rw-r--r-- | hw/input/milkymist-softusb.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 942cb79717..ecde33cb95 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -44,8 +44,13 @@ enum { #define COMLOC_KEVT_PRODUCE 0x1142 #define COMLOC_KEVT_BASE 0x1143 +#define TYPE_MILKYMIST_SOFTUSB "milkymist-softusb" +#define MILKYMIST_SOFTUSB(obj) \ + OBJECT_CHECK(MilkymistSoftUsbState, (obj), TYPE_MILKYMIST_SOFTUSB) + struct MilkymistSoftUsbState { - SysBusDevice busdev; + SysBusDevice parent_obj; + HIDState hid_kbd; HIDState hid_mouse; @@ -242,8 +247,7 @@ static void softusb_mouse_hid_datain(HIDState *hs) static void milkymist_softusb_reset(DeviceState *d) { - MilkymistSoftUsbState *s = - container_of(d, MilkymistSoftUsbState, busdev.qdev); + MilkymistSoftUsbState *s = MILKYMIST_SOFTUSB(d); int i; for (i = 0; i < R_MAX; i++) { @@ -261,7 +265,7 @@ static void milkymist_softusb_reset(DeviceState *d) static int milkymist_softusb_init(SysBusDevice *dev) { - MilkymistSoftUsbState *s = FROM_SYSBUS(typeof(*s), dev); + MilkymistSoftUsbState *s = MILKYMIST_SOFTUSB(dev); sysbus_init_irq(dev, &s->irq); @@ -320,7 +324,7 @@ static void milkymist_softusb_class_init(ObjectClass *klass, void *data) } static const TypeInfo milkymist_softusb_info = { - .name = "milkymist-softusb", + .name = TYPE_MILKYMIST_SOFTUSB, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistSoftUsbState), .class_init = milkymist_softusb_class_init, |