diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2012-04-12 12:44:13 +1000 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-04-15 20:02:28 +0200 |
commit | b1c7f725a3bc5fec87912e907066edd6b80b878c (patch) | |
tree | f0dc5ea24401023577b1e29b7739e1e3cacbd7ec /hw/spapr_vio.c | |
parent | 91067bf8689ad4a4489a5080812619a9eb932716 (diff) | |
download | qemu-b1c7f725a3bc5fec87912e907066edd6b80b878c.zip qemu-b1c7f725a3bc5fec87912e907066edd6b80b878c.tar.gz qemu-b1c7f725a3bc5fec87912e907066edd6b80b878c.tar.bz2 |
pseries: Correctly use the device model reset hooks
Recently we added code to properly clean away VIO CRQs on reset However,
this directly uses qemu_register, rather than the existing device model
reset callbacks. This patch cleans this up by adding proper use of the
reset hook to the VIO bus model. The existing CRQ reset code is converted
to the new method.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/spapr_vio.c')
-rw-r--r-- | hw/spapr_vio.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 0bf2c31..fccf48b 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -648,13 +648,18 @@ static int spapr_vio_check_reg(VIOsPAPRDevice *sdev) return 0; } -static void spapr_vio_busdev_reset(void *opaque) +static void spapr_vio_busdev_reset(DeviceState *qdev) { - VIOsPAPRDevice *dev = (VIOsPAPRDevice *)opaque; + VIOsPAPRDevice *dev = DO_UPCAST(VIOsPAPRDevice, qdev, qdev); + VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev); if (dev->crq.qsize) { free_crq(dev); } + + if (pc->reset) { + pc->reset(dev); + } } static int spapr_vio_busdev_init(DeviceState *qdev) @@ -685,8 +690,6 @@ static int spapr_vio_busdev_init(DeviceState *qdev) rtce_init(dev); - qemu_register_reset(spapr_vio_busdev_reset, dev); - return pc->init(dev); } @@ -776,6 +779,7 @@ static void vio_spapr_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); k->init = spapr_vio_busdev_init; + k->reset = spapr_vio_busdev_reset; k->bus_info = &spapr_vio_bus_info; } |