Patchwork [v2,23/30] usb/*: substitute ->qdev casts with DEVICE()

login
register
mail settings
Submitter Peter Crosthwaite
Date June 24, 2013, 7:06 a.m.
Message ID <7cc26bf76f027f0e12f74ca0c4dbc1785208f582.1372055322.git.peter.crosthwaite@xilinx.com>
Download mbox | patch
Permalink /patch/253681/
State New
Headers show

Comments

Peter Crosthwaite - June 24, 2013, 7:06 a.m.
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/usb/hcd-ehci-pci.c | 13 ++++++++-----
 hw/usb/hcd-ohci.c     |  2 +-
 hw/usb/hcd-uhci.c     |  2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

Patch

diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index f1b5f5d..998a9bf 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -197,6 +197,7 @@  int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
     const struct ehci_companions *comp;
     PCIDevice *ehci, *uhci;
     BusState *usbbus;
+    DeviceState *dev;
     const char *name;
     int i;
 
@@ -214,15 +215,17 @@  int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
     }
 
     ehci = pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name);
-    qdev_init_nofail(&ehci->qdev);
-    usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
+    dev = DEVICE(ehci);
+    qdev_init_nofail(dev);
+    usbbus = QLIST_FIRST(&dev->child_bus);
 
     for (i = 0; i < 3; i++) {
         uhci = pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].func),
                                         true, comp[i].name);
-        qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
-        qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
-        qdev_init_nofail(&uhci->qdev);
+        dev = DEVICE(uhci);
+        qdev_prop_set_string(dev, "masterbus", usbbus->name);
+        qdev_prop_set_uint32(dev, "firstport", comp[i].port);
+        qdev_init_nofail(dev);
     }
     return 0;
 }
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 5513924..2f88db6 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1857,7 +1857,7 @@  static int usb_ohci_initfn_pci(struct PCIDevice *dev)
     ohci->pci_dev.config[PCI_CLASS_PROG] = 0x10; /* OHCI */
     ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */
 
-    if (usb_ohci_init(&ohci->state, &dev->qdev, ohci->num_ports, 0,
+    if (usb_ohci_init(&ohci->state, DEVICE(dev), ohci->num_ports, 0,
                       ohci->masterbus, ohci->firstport,
                       pci_get_address_space(dev)) != 0) {
         return -1;
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index c85b203..67c13c3 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1246,7 +1246,7 @@  static int usb_uhci_common_initfn(PCIDevice *dev)
             return -1;
         }
     } else {
-        usb_bus_new(&s->bus, &uhci_bus_ops, &s->dev.qdev);
+        usb_bus_new(&s->bus, &uhci_bus_ops, DEVICE(dev));
         for (i = 0; i < NB_PORTS; i++) {
             usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);