etraxfs_pic: QOM cast cleanup

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-07-26 19:05:58 +02:00
parent 285b4432da
commit 9062143f9e

View File

@ -36,9 +36,14 @@
#define R_R_GURU 4 #define R_R_GURU 4
#define R_MAX 5 #define R_MAX 5
#define TYPE_ETRAX_FS_PIC "etraxfs,pic"
#define ETRAX_FS_PIC(obj) \
OBJECT_CHECK(struct etrax_pic, (obj), TYPE_ETRAX_FS_PIC)
struct etrax_pic struct etrax_pic
{ {
SysBusDevice busdev; SysBusDevice parent_obj;
MemoryRegion mmio; MemoryRegion mmio;
void *interrupt_vector; void *interrupt_vector;
qemu_irq parent_irq; qemu_irq parent_irq;
@ -138,17 +143,18 @@ static void irq_handler(void *opaque, int irq, int level)
pic_update(fs); pic_update(fs);
} }
static int etraxfs_pic_init(SysBusDevice *dev) static int etraxfs_pic_init(SysBusDevice *sbd)
{ {
struct etrax_pic *s = FROM_SYSBUS(typeof (*s), dev); DeviceState *dev = DEVICE(sbd);
struct etrax_pic *s = ETRAX_FS_PIC(dev);
qdev_init_gpio_in(&dev->qdev, irq_handler, 32); qdev_init_gpio_in(dev, irq_handler, 32);
sysbus_init_irq(dev, &s->parent_irq); sysbus_init_irq(sbd, &s->parent_irq);
sysbus_init_irq(dev, &s->parent_nmi); sysbus_init_irq(sbd, &s->parent_nmi);
memory_region_init_io(&s->mmio, OBJECT(s), &pic_ops, s, memory_region_init_io(&s->mmio, OBJECT(s), &pic_ops, s,
"etraxfs-pic", R_MAX * 4); "etraxfs-pic", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio); sysbus_init_mmio(sbd, &s->mmio);
return 0; return 0;
} }
@ -167,7 +173,7 @@ static void etraxfs_pic_class_init(ObjectClass *klass, void *data)
} }
static const TypeInfo etraxfs_pic_info = { static const TypeInfo etraxfs_pic_info = {
.name = "etraxfs,pic", .name = TYPE_ETRAX_FS_PIC,
.parent = TYPE_SYS_BUS_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(struct etrax_pic), .instance_size = sizeof(struct etrax_pic),
.class_init = etraxfs_pic_class_init, .class_init = etraxfs_pic_class_init,