Patchwork [10/15] qdev: switch reset to post-order

login
register
mail settings
Submitter Paolo Bonzini
Date Dec. 17, 2012, 4:24 p.m.
Message ID <1355761490-10073-11-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/206930/
State New
Headers show

Comments

Paolo Bonzini - Dec. 17, 2012, 4:24 p.m.
Post-order is the only sensible direction for the reset signals.  For example,
suppose pre-order is used and the parent has some data structures that cache
children state (for example a list of active requests).  When the reset
method is invoked on the parent, these caches cannot be left in a consistent
state, nor asserted to be in a consistent state.

If post-order is used, on the other hand, these will be in a known state
when the reset method is invoked on the parent.

I checked the existing bus-reset implementation and they are all fine with
post-order.  USB doesn't use qdev reset, but it should be fine with post-order
too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index 457f7bf..833d571 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -227,12 +227,12 @@  static int qbus_reset_one(BusState *bus, void *opaque)
 
 void qdev_reset_all(DeviceState *dev)
 {
-    qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL, NULL, NULL);
+    qdev_walk_children(dev, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
 }
 
 void qbus_reset_all(BusState *bus)
 {
-    qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL, NULL, NULL);
+    qbus_walk_children(bus, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL);
 }
 
 void qbus_reset_all_fn(void *opaque)