Patchwork [14/26] usb-ohci: Change casts to DO_UPCAST() for OHCIPCIState

login
register
mail settings
Submitter Juan Quintela
Date Aug. 24, 2009, 4:42 p.m.
Message ID <2363612038057bcd1cedd9a7a2a518b410746d06.1251131364.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/31978/
State Superseded
Headers show

Comments

Juan Quintela - Aug. 24, 2009, 4:42 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/usb-ohci.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 4c42ec0..fbebf1d 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -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;