Patchwork [11/15] qdev: remove device_reset

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

Comments

Paolo Bonzini - Dec. 17, 2012, 4:24 p.m.
The right thing to do is always to use qdev_reset_all (or qbus_reset_all).
Call the reset method straight from qdev_reset_one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev-core.h |  7 -------
 hw/qdev.c      | 15 +++++----------
 2 files changed, 5 insertions(+), 17 deletions(-)

Patch

diff --git a/hw/qdev-core.h b/hw/qdev-core.h
index 7c2598e..28f12a4 100644
--- a/hw/qdev-core.h
+++ b/hw/qdev-core.h
@@ -218,13 +218,6 @@  char *qdev_get_fw_dev_path(DeviceState *dev);
  */
 void qdev_machine_init(void);
 
-/**
- * @device_reset
- *
- * Reset a single device (by calling the reset method).
- */
-void device_reset(DeviceState *dev);
-
 const struct VMStateDescription *qdev_get_vmsd(DeviceState *dev);
 
 const char *qdev_fw_name(DeviceState *dev);
diff --git a/hw/qdev.c b/hw/qdev.c
index 833d571..1736d6f 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -211,7 +211,11 @@  void qdev_unplug(DeviceState *dev, Error **errp)
 
 static int qdev_reset_one(DeviceState *dev, void *opaque)
 {
-    device_reset(dev);
+    DeviceClass *klass = DEVICE_GET_CLASS(dev);
+
+    if (klass->reset) {
+        klass->reset(dev);
+    }
 
     return 0;
 }
@@ -750,15 +754,6 @@  static void device_class_init(ObjectClass *class, void *data)
     class->unparent = qdev_remove_from_bus;
 }
 
-void device_reset(DeviceState *dev)
-{
-    DeviceClass *klass = DEVICE_GET_CLASS(dev);
-
-    if (klass->reset) {
-        klass->reset(dev);
-    }
-}
-
 Object *qdev_get_machine(void)
 {
     static Object *dev;