usb-ohci: Change casts to DO_UPCAST() for OHCIPCIState
authorJuan Quintela <quintela@redhat.com>
Mon, 24 Aug 2009 16:42:48 +0000 (18:42 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 28 Aug 2009 01:46:59 +0000 (20:46 -0500)
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/usb-ohci.c

index 093623fc42ffddfb9ab0f93f19b7fe0ab99918cb..0c08e9fff32072b1f03a532ceb79410ddb758fee 100644 (file)
@@ -1706,7 +1706,7 @@ typedef struct {
 static void ohci_mapfunc(PCIDevice *pci_dev, int i,
             uint32_t addr, uint32_t size, int type)
 {
-    OHCIPCIState *ohci = (OHCIPCIState *)pci_dev;
+    OHCIPCIState *ohci = DO_UPCAST(OHCIPCIState, pci_dev, pci_dev);
     cpu_register_physical_memory(addr, size, ohci->state.mem);
 }
 
@@ -1714,8 +1714,9 @@ void usb_ohci_init_pci(struct PCIBus *bus, int num_ports, int devfn)
 {
     OHCIPCIState *ohci;
 
-    ohci = (OHCIPCIState *)pci_register_device(bus, "OHCI USB", sizeof(*ohci),
-                                               devfn, NULL, NULL);
+    ohci = DO_UPCAST(OHCIPCIState, pci_dev,
+                     pci_register_device(bus, "OHCI USB", sizeof(*ohci),
+                                         devfn, NULL, NULL));
     if (ohci == NULL) {
         fprintf(stderr, "usb-ohci: Failed to register PCI device\n");
         return;