Il 10/07/2012 08:16, Liu Ping Fan ha scritto: > Signed-off-by: Liu Ping Fan <pingf...@linux.vnet.ibm.com> > --- > hw/qdev.c | 17 ++++++++++++----- > hw/qdev.h | 2 ++ > 2 files changed, 14 insertions(+), 5 deletions(-) > > diff --git a/hw/qdev.c b/hw/qdev.c > index d2100a1..f7983e4 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -249,11 +249,9 @@ static int qdev_reset_one(DeviceState *dev, void *opaque) > > static int qbus_reset_one(BusState *bus, void *opaque) > { > - BusClass *bc = BUS_GET_CLASS(bus); > - if (bc->reset) { > - return bc->reset(bus); > - } > - return 0; > + int ret; > + ret = bus_reset(bus); > + return ret; > } > > void qdev_reset_all(DeviceState *dev) > @@ -766,6 +764,15 @@ void device_reset(DeviceState *dev) > } > } > > +int bus_reset(BusState *bus) > +{ > + BusClass *bc = BUS_GET_CLASS(bus); > + if (bc->reset) { > + return bc->reset(bus); > + } > + return 0; > +}
Two comments: 1) Is this correct? Resetting a bus should reset all the children before resetting the bus itself. 2) Does it make sense to export it, since we're going towards removing unnecessary buses? Paolo > + > Object *qdev_get_machine(void) > { > static Object *dev; > diff --git a/hw/qdev.h b/hw/qdev.h > index aecc69e..5f88b4b 100644 > --- a/hw/qdev.h > +++ b/hw/qdev.h > @@ -356,6 +356,8 @@ void qdev_machine_init(void); > */ > void device_reset(DeviceState *dev); > > +int bus_reset(BusState *bus); > + > const VMStateDescription *qdev_get_vmsd(DeviceState *dev); > > const char *qdev_fw_name(DeviceState *dev); >