From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoVzq-0003ik-Gn for qemu-devel@nongnu.org; Tue, 10 Jul 2012 04:40:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoVzl-0002Hd-Os for qemu-devel@nongnu.org; Tue, 10 Jul 2012 04:40:38 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:50614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoVzl-0002HW-FQ for qemu-devel@nongnu.org; Tue, 10 Jul 2012 04:40:33 -0400 Received: by pbbro12 with SMTP id ro12so22243508pbb.4 for ; Tue, 10 Jul 2012 01:40:31 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FFBEA79.1000202@redhat.com> Date: Tue, 10 Jul 2012 10:40:25 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1341900967-4344-1-git-send-email-qemulist@gmail.com> <1341900967-4344-4-git-send-email-qemulist@gmail.com> In-Reply-To: <1341900967-4344-4-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Blue Swirl , Jan Kiszka , qemu-devel@nongnu.org, Anthony Liguori , =?ISO-8859-15?Q?Andreas_F=E4rber?= Il 10/07/2012 08:16, Liu Ping Fan ha scritto: > Signed-off-by: Liu Ping Fan > --- > 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); >