diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-25 00:35:51 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:05:59 +0200 |
commit | 66c2de562f504895eeb407a04dddd4c76ab70c50 (patch) | |
tree | c26c2424cdd1ffb5bc6370556124808926b7797e | |
parent | 0f31aa86255e97295b4d81e3d03a527974746d63 (diff) | |
download | qemu-66c2de562f504895eeb407a04dddd4c76ab70c50.zip qemu-66c2de562f504895eeb407a04dddd4c76ab70c50.tar.gz qemu-66c2de562f504895eeb407a04dddd4c76ab70c50.tar.bz2 |
jazz_led: QOM cast cleanup
Introduce a type constant, use QOM casts and rename the parent field.
Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r-- | hw/display/jazz_led.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 7f82037..8407e6c 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -32,8 +32,12 @@ typedef enum { REDRAW_NONE = 0, REDRAW_SEGMENTS = 1, REDRAW_BACKGROUND = 2, } screen_state_t; +#define TYPE_JAZZ_LED "jazz-led" +#define JAZZ_LED(obj) OBJECT_CHECK(LedState, (obj), TYPE_JAZZ_LED) + typedef struct LedState { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion iomem; uint8_t segments; QemuConsole *con; @@ -262,7 +266,7 @@ static const GraphicHwOps jazz_led_ops = { static int jazz_led_init(SysBusDevice *dev) { - LedState *s = FROM_SYSBUS(LedState, dev); + LedState *s = JAZZ_LED(dev); memory_region_init_io(&s->iomem, OBJECT(s), &led_ops, s, "led", 1); sysbus_init_mmio(dev, &s->iomem); @@ -274,7 +278,7 @@ static int jazz_led_init(SysBusDevice *dev) static void jazz_led_reset(DeviceState *d) { - LedState *s = DO_UPCAST(LedState, busdev.qdev, d); + LedState *s = JAZZ_LED(d); s->segments = 0; s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND; @@ -293,7 +297,7 @@ static void jazz_led_class_init(ObjectClass *klass, void *data) } static const TypeInfo jazz_led_info = { - .name = "jazz-led", + .name = TYPE_JAZZ_LED, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(LedState), .class_init = jazz_led_class_init, |