Patchwork [01/26] eepro100: convert casts to DO_UPCAST()

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

Comments

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

Patch

diff --git a/hw/eepro100.c b/hw/eepro100.c
index ec31a6a..3c58ec1 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1346,7 +1346,7 @@  typedef struct PCIEEPRO100State {
 static void pci_map(PCIDevice * pci_dev, int region_num,
                     uint32_t addr, uint32_t size, int type)
 {
-    PCIEEPRO100State *d = (PCIEEPRO100State *) pci_dev;
+    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, pci_dev);
     EEPRO100State *s = &d->eepro100;

     logout("region %d, addr=0x%08x, size=0x%08x, type=%d\n",
@@ -1420,7 +1420,7 @@  static CPUReadMemoryFunc *pci_mmio_read[] = {
 static void pci_mmio_map(PCIDevice * pci_dev, int region_num,
                          uint32_t addr, uint32_t size, int type)
 {
-    PCIEEPRO100State *d = (PCIEEPRO100State *) pci_dev;
+    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, pci_dev);

     logout("region %d, addr=0x%08x, size=0x%08x, type=%d\n",
            region_num, addr, size, type);
@@ -1720,7 +1720,7 @@  static void nic_cleanup(VLANClientState *vc)

 static int pci_nic_uninit(PCIDevice *dev)
 {
-    PCIEEPRO100State *d = (PCIEEPRO100State *) dev;
+    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, dev);
     EEPRO100State *s = &d->eepro100;

     cpu_unregister_io_memory(s->mmio_index);
@@ -1730,7 +1730,7 @@  static int pci_nic_uninit(PCIDevice *dev)

 static void nic_init(PCIDevice *pci_dev, uint32_t device)
 {
-    PCIEEPRO100State *d = (PCIEEPRO100State *)pci_dev;
+    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, pci_dev);
     EEPRO100State *s;

     logout("\n");