[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 042/107] hw/gpio: QOM'ify mpc8xxx.c
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 042/107] hw/gpio: QOM'ify mpc8xxx.c |
Date: |
Thu, 2 Feb 2017 16:13:40 +1100 |
From: xiaoqiang zhao <address@hidden>
* Drop the old SysBus init function and use instance_init
* Change mpc8xxx_gpio_reset to a DeviceClass::reset function
Signed-off-by: xiaoqiang zhao <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/gpio/mpc8xxx.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/hw/gpio/mpc8xxx.c b/hw/gpio/mpc8xxx.c
index d149719..e12edb4 100644
--- a/hw/gpio/mpc8xxx.c
+++ b/hw/gpio/mpc8xxx.c
@@ -143,8 +143,10 @@ static void mpc8xxx_gpio_write(void *opaque, hwaddr offset,
mpc8xxx_gpio_update(s);
}
-static void mpc8xxx_gpio_reset(MPC8XXXGPIOState *s)
+static void mpc8xxx_gpio_reset(DeviceState *dev)
{
+ MPC8XXXGPIOState *s = MPC8XXX_GPIO(dev);
+
s->dir = 0;
s->odr = 0;
s->dat = 0;
@@ -180,33 +182,33 @@ static const MemoryRegionOps mpc8xxx_gpio_ops = {
.endianness = DEVICE_BIG_ENDIAN,
};
-static int mpc8xxx_gpio_initfn(SysBusDevice *sbd)
+static void mpc8xxx_gpio_initfn(Object *obj)
{
- DeviceState *dev = DEVICE(sbd);
- MPC8XXXGPIOState *s = MPC8XXX_GPIO(dev);
+ DeviceState *dev = DEVICE(obj);
+ MPC8XXXGPIOState *s = MPC8XXX_GPIO(obj);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
- memory_region_init_io(&s->iomem, OBJECT(s), &mpc8xxx_gpio_ops, s,
"mpc8xxx_gpio", 0x1000);
+ memory_region_init_io(&s->iomem, obj, &mpc8xxx_gpio_ops,
+ s, "mpc8xxx_gpio", 0x1000);
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq);
qdev_init_gpio_in(dev, mpc8xxx_gpio_set_irq, 32);
qdev_init_gpio_out(dev, s->out, 32);
- mpc8xxx_gpio_reset(s);
- return 0;
}
static void mpc8xxx_gpio_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = mpc8xxx_gpio_initfn;
dc->vmsd = &vmstate_mpc8xxx_gpio;
+ dc->reset = mpc8xxx_gpio_reset;
}
static const TypeInfo mpc8xxx_gpio_info = {
.name = TYPE_MPC8XXX_GPIO,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MPC8XXXGPIOState),
+ .instance_init = mpc8xxx_gpio_initfn,
.class_init = mpc8xxx_gpio_class_init,
};
--
2.9.3
- [Qemu-ppc] [PULL 032/107] prep: do not use global variable to access nvram, (continued)
- [Qemu-ppc] [PULL 032/107] prep: do not use global variable to access nvram, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 031/107] hw/ppc/spapr: Fix boot path of usb-host storage devices, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 039/107] libqos: fix spapr qpci_map(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 044/107] hw/ppc: QOM'ify ppce500_spin.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 034/107] ppc: Rewrite ppc_set_compat(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 051/107] target-ppc: Use float64 arg in helper_compute_fprf(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 047/107] target-ppc: Add xxinsertw instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 026/107] target-ppc: Add xxperm and xxpermr instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 059/107] target-ppc: Add xsxsigqp instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 028/107] target-ppc: implement lxvll instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 042/107] hw/gpio: QOM'ify mpc8xxx.c,
David Gibson <=
- [Qemu-ppc] [PULL 066/107] ppc: Prevent inifnite loop in decrementer auto-reload., David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 069/107] softfloat: Fix the default qNAN for target-ppc, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 049/107] prep: add IBM RS/6000 7020 (40p) memory controller, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 067/107] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 029/107] target-ppc: implement stxvl instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 043/107] hw/ppc: QOM'ify e500.c, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 035/107] ppc: Rewrite ppc_get_compat_smt_threads(), David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 030/107] target-ppc: implement stxvll instructions, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 046/107] target-ppc: Add xxextractuw instruction, David Gibson, 2017/02/02
- [Qemu-ppc] [PULL 040/107] qtest: convert ivshmem-test to use libqos, David Gibson, 2017/02/02