summaryrefslogtreecommitdiffstats
path: root/hw/intc/puv3_intc.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-07-29 14:39:49 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2013-07-29 14:39:49 -0500
commit6a4992d0bdeb38a57314d731d9846063b2057e6c (patch)
tree10d359f7bec5918dd1fc6d9a445213f3019d1929 /hw/intc/puv3_intc.c
parenteddbf0ab9db8385d7cb57e23891c1d41488b303e (diff)
parentb67964d70219a864ec427e727754a205475c7d6c (diff)
downloadhqemu-6a4992d0bdeb38a57314d731d9846063b2057e6c.zip
hqemu-6a4992d0bdeb38a57314d731d9846063b2057e6c.tar.gz
Merge remote-tracking branch 'afaerber/tags/qom-devices-for-anthony' into staging
QOM device refactorings * Replace all uses of FROM_SYSBUS() macro with QOM cast macros i) "QOM cast cleanup for X" Indicates a mechanical 1:1 between TYPE_* and *State. ii) "QOM'ify X and Y" Indicates abstract types may have been inserted or similar changes to type hierarchy. ii) Renames Coding Style fixes such as CamelCase have been applied in some cases. * Fix for sparc floppy - cf. ii) above * Change PCI type hierarchy to provide PCI_BRIDGE() casts * In doing so, prepare for adopting QOM realize # gpg: Signature made Mon 29 Jul 2013 02:15:22 PM CDT using RSA key ID 3E7E013F # gpg: Can't check signature: public key not found # By Andreas Färber (171) and others # Via Andreas Färber * afaerber/tags/qom-devices-for-anthony: (173 commits) sysbus: QOM parent field cleanup for SysBusDevice spapr_pci: QOM cast cleanup ioapic: QOM cast cleanup kvm/ioapic: QOM cast cleanup kvmvapic: QOM cast cleanup mipsnet: QOM cast cleanup opencores_eth: QOM cast cleanup exynos4210_i2c: QOM cast cleanup sysbus: Remove unused sysbus_new() prototype sysbus: Drop FROM_SYSBUS() xilinx_timer: QOM cast cleanup tusb6010: QOM cast cleanup slavio_timer: QOM cast cleanup pxa2xx_timer: QOM'ify pxa25x-timer and pxa27x-timer puv3_ost: QOM cast cleanup pl031: QOM cast cleanup pl031: Rename pl031_state to PL031State milkymist-sysctl: QOM cast cleanup m48t59: QOM cast cleanup for M48t59SysBusState lm32_timer: QOM cast cleanup ...
Diffstat (limited to 'hw/intc/puv3_intc.c')
-rw-r--r--hw/intc/puv3_intc.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c
index 44b6651..c2803d0 100644
--- a/hw/intc/puv3_intc.c
+++ b/hw/intc/puv3_intc.c
@@ -13,8 +13,12 @@
#undef DEBUG_PUV3
#include "hw/unicore32/puv3.h"
-typedef struct {
- SysBusDevice busdev;
+#define TYPE_PUV3_INTC "puv3_intc"
+#define PUV3_INTC(obj) OBJECT_CHECK(PUV3INTCState, (obj), TYPE_PUV3_INTC)
+
+typedef struct PUV3INTCState {
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
qemu_irq parent_irq;
@@ -96,19 +100,20 @@ static const MemoryRegionOps puv3_intc_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int puv3_intc_init(SysBusDevice *dev)
+static int puv3_intc_init(SysBusDevice *sbd)
{
- PUV3INTCState *s = FROM_SYSBUS(PUV3INTCState, dev);
+ DeviceState *dev = DEVICE(sbd);
+ PUV3INTCState *s = PUV3_INTC(dev);
- qdev_init_gpio_in(&s->busdev.qdev, puv3_intc_handler, PUV3_IRQS_NR);
- sysbus_init_irq(&s->busdev, &s->parent_irq);
+ qdev_init_gpio_in(dev, puv3_intc_handler, PUV3_IRQS_NR);
+ sysbus_init_irq(sbd, &s->parent_irq);
s->reg_ICMR = 0;
s->reg_ICPR = 0;
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_intc_ops, s, "puv3_intc",
- PUV3_REGS_OFFSET);
- sysbus_init_mmio(dev, &s->iomem);
+ PUV3_REGS_OFFSET);
+ sysbus_init_mmio(sbd, &s->iomem);
return 0;
}
@@ -121,7 +126,7 @@ static void puv3_intc_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo puv3_intc_info = {
- .name = "puv3_intc",
+ .name = TYPE_PUV3_INTC,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(PUV3INTCState),
.class_init = puv3_intc_class_init,
OpenPOWER on IntegriCloud