From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoTki-0007oM-13 for qemu-devel@nongnu.org; Tue, 10 Jul 2012 02:16:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SoTkf-0001Mf-Lp for qemu-devel@nongnu.org; Tue, 10 Jul 2012 02:16:51 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:52368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SoTkf-0001Lt-FA for qemu-devel@nongnu.org; Tue, 10 Jul 2012 02:16:49 -0400 Received: by ghrr14 with SMTP id r14so11759246ghr.4 for ; Mon, 09 Jul 2012 23:16:47 -0700 (PDT) From: Liu Ping Fan Date: Tue, 10 Jul 2012 14:16:05 +0800 Message-Id: <1341900967-4344-4-git-send-email-qemulist@gmail.com> In-Reply-To: <1341900967-4344-1-git-send-email-qemulist@gmail.com> References: <1341900967-4344-1-git-send-email-qemulist@gmail.com> Subject: [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori 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; +} + 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); -- 1.7.4.4