pl041: QOM cast cleanup
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>
This commit is contained in:
parent
baae672597
commit
b354f03c5c
@ -70,8 +70,12 @@ typedef struct {
|
|||||||
uint8_t rx_sample_size;
|
uint8_t rx_sample_size;
|
||||||
} pl041_channel;
|
} pl041_channel;
|
||||||
|
|
||||||
|
#define TYPE_PL041 "pl041"
|
||||||
|
#define PL041(obj) OBJECT_CHECK(PL041State, (obj), TYPE_PL041)
|
||||||
|
|
||||||
typedef struct PL041State {
|
typedef struct PL041State {
|
||||||
SysBusDevice busdev;
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
|
|
||||||
@ -504,7 +508,7 @@ static void pl041_write(void *opaque, hwaddr offset,
|
|||||||
|
|
||||||
static void pl041_device_reset(DeviceState *d)
|
static void pl041_device_reset(DeviceState *d)
|
||||||
{
|
{
|
||||||
PL041State *s = DO_UPCAST(PL041State, busdev.qdev, d);
|
PL041State *s = PL041(d);
|
||||||
|
|
||||||
pl041_reset(s);
|
pl041_reset(s);
|
||||||
}
|
}
|
||||||
@ -517,7 +521,7 @@ static const MemoryRegionOps pl041_ops = {
|
|||||||
|
|
||||||
static int pl041_init(SysBusDevice *dev)
|
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);
|
DBG_L1("pl041_init 0x%08x\n", (uint32_t)s);
|
||||||
|
|
||||||
@ -635,7 +639,7 @@ static void pl041_device_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo pl041_device_info = {
|
static const TypeInfo pl041_device_info = {
|
||||||
.name = "pl041",
|
.name = TYPE_PL041,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(PL041State),
|
.instance_size = sizeof(PL041State),
|
||||||
.class_init = pl041_device_class_init,
|
.class_init = pl041_device_class_init,
|
||||||
|
Loading…
Reference in New Issue
Block a user