Patchwork [v2,05/10] xhci: Clean up reset function

login
register
mail settings
Submitter Jan Kiszka
Date May 10, 2012, 8:08 p.m.
Message ID <011de1b5a67b8423a66e084bf315acfa62d939b3.1336680504.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/158398/
State New
Headers show

Comments

Jan Kiszka - May 10, 2012, 8:08 p.m.
Properly register reset function via the device class.

CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/usb/hcd-xhci.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index c4079eb..814117c 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2339,9 +2339,9 @@  static void xhci_reset_full(XHCIState *xhci)
     xhci->ev_buffer_get = 0;
 }
 
-static void xhci_reset(void *opaque)
+static void xhci_reset(DeviceState *dev)
 {
-    XHCIState *xhci = opaque;
+    XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev.qdev, dev);
 
     msi_reset(&xhci->pci_dev);
     xhci_reset_full(xhci);
@@ -2838,8 +2838,6 @@  static void usb_xhci_init(XHCIState *xhci, DeviceState *dev)
     for (i = 0; i < MAXSLOTS; i++) {
         xhci->slots[i].enabled = 0;
     }
-
-    qemu_register_reset(xhci_reset, xhci);
 }
 
 static int usb_xhci_initfn(struct PCIDevice *dev)
@@ -2902,6 +2900,7 @@  static void xhci_class_init(ObjectClass *klass, void *data)
 
     dc->vmsd    = &vmstate_xhci;
     dc->props   = xhci_properties;
+    dc->reset   = xhci_reset;
     k->init         = usb_xhci_initfn;
     k->vendor_id    = PCI_VENDOR_ID_NEC;
     k->device_id    = PCI_DEVICE_ID_NEC_UPD720200;