[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 42/67] hw/gpio: QOM'ify mpc8xxx.c
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 42/67] hw/gpio: QOM'ify mpc8xxx.c |
Date: |
Thu, 12 Jan 2017 13:03:02 +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 66/67] ppc: Prevent inifnite loop in decrementer auto-reload., (continued)
- [Qemu-ppc] [PULL 66/67] ppc: Prevent inifnite loop in decrementer auto-reload., David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 55/67] target-ppc: Use correct precision for FPRF setting, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 63/67] target-ppc: Add xsaddqp instructions, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 54/67] target-ppc: Add xscvdphp, xscvhpdp, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 53/67] target-ppc: Rename helper_compute_fprf to helper_compute_fprf_float64, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 48/67] prep: add PReP System I/O, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 17/67] ppc: Clean up and QOMify hypercall emulation, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 37/67] qtest: add netfilter tests for ppc64, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 27/67] target-ppc: implement lxvl instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 28/67] target-ppc: implement lxvll instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 42/67] hw/gpio: QOM'ify mpc8xxx.c,
David Gibson <=
- [Qemu-ppc] [PULL 39/67] libqos: fix spapr qpci_map(), David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 31/67] hw/ppc/spapr: Fix boot path of usb-host storage devices, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 44/67] hw/ppc: QOM'ify ppce500_spin.c, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 34/67] ppc: Rewrite ppc_set_compat(), David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 51/67] target-ppc: Use float64 arg in helper_compute_fprf(), David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 56/67] target-ppc: Add xsxexpdp instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 43/67] hw/ppc: QOM'ify e500.c, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 57/67] target-ppc: Add xsxexpqp instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 65/67] target-ppc: Add xscvqpdp instruction, David Gibson, 2017/01/11
- [Qemu-ppc] [PULL 58/67] target-ppc: Add xsxsigdp instruction, David Gibson, 2017/01/11