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>
This commit is contained in:
parent
0f31aa8625
commit
66c2de562f
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user