From patchwork Thu Sep 2 09:25:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/6] qdev: introduce a helper function which triggers reset from a given device. From: Isaku Yamahata X-Patchwork-Id: 63459 Message-Id: To: qemu-devel@nongnu.org Cc: gleb@redhat.com, glommer@redhat.com, blauwirbel@gmail.com, yamahata@valinux.co.jp, alex.williamson@redhat.com, avi@redhat.com, pbonzini@redhat.com Date: Thu, 2 Sep 2010 18:25:06 +0900 introduce a helper function which triggers reset on device tree from a given device. Signed-off-by: Isaku Yamahata --- hw/qdev-core.h | 1 + hw/qdev.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index 49ac87a..20ebe1f 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -195,6 +195,7 @@ int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, DeviceState *qbus_find_child_dev(BusState *bus, const char *id); BusState *qbus_find_child_bus(BusState *bus, const char *id); +void qdev_reset_all(DeviceState *dev); void qbus_reset_all(BusState *bus); void qbus_realize_all(BusState *bus); diff --git a/hw/qdev.c b/hw/qdev.c index 9300d7f..191dfac 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -174,6 +174,11 @@ static int qbus_reset_one(BusState *bus, void *opaque) return 0; } +void qdev_reset_all(DeviceState *dev) +{ + qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL); +} + void qbus_reset_all(BusState *bus) { qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL);