Skip to content

Commit

Permalink
pl041: QOM cast cleanup
Browse files Browse the repository at this point in the history
Introduce a type constant, use QOM casts and rename the parent field.

Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Jul 29, 2013
1 parent baae672 commit b354f03
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions hw/audio/pl041.c
Expand Up @@ -70,8 +70,12 @@ typedef struct {
uint8_t rx_sample_size;
} pl041_channel;

#define TYPE_PL041 "pl041"
#define PL041(obj) OBJECT_CHECK(PL041State, (obj), TYPE_PL041)

typedef struct PL041State {
SysBusDevice busdev;
SysBusDevice parent_obj;

MemoryRegion iomem;
qemu_irq irq;

Expand Down Expand Up @@ -504,7 +508,7 @@ static void pl041_write(void *opaque, hwaddr offset,

static void pl041_device_reset(DeviceState *d)
{
PL041State *s = DO_UPCAST(PL041State, busdev.qdev, d);
PL041State *s = PL041(d);

pl041_reset(s);
}
Expand All @@ -517,7 +521,7 @@ static const MemoryRegionOps pl041_ops = {

static int pl041_init(SysBusDevice *dev)
{
PL041State *s = FROM_SYSBUS(PL041State, dev);
PL041State *s = PL041(dev);

DBG_L1("pl041_init 0x%08x\n", (uint32_t)s);

Expand Down Expand Up @@ -635,7 +639,7 @@ static void pl041_device_class_init(ObjectClass *klass, void *data)
}

static const TypeInfo pl041_device_info = {
.name = "pl041",
.name = TYPE_PL041,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(PL041State),
.class_init = pl041_device_class_init,
Expand Down

0 comments on commit b354f03

Please sign in to comment.