Patchwork [23/26] pcnet: Change casts to DO_UPCAST() for PCIPCNetState

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

Comments

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

Patch

diff --git a/hw/pcnet.c b/hw/pcnet.c
index 637dcfb..23a577e 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1764,7 +1764,7 @@  static uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr)
 static void pcnet_ioport_map(PCIDevice *pci_dev, int region_num,
                              uint32_t addr, uint32_t size, int type)
 {
-    PCNetState *d = &((PCIPCNetState *)pci_dev)->state;
+    PCNetState *d = &DO_UPCAST(PCIPCNetState, pci_dev, pci_dev)->state;

 #ifdef PCNET_DEBUG_IO
     printf("pcnet_ioport_map addr=0x%04x size=0x%04x\n", addr, size);
@@ -1978,7 +1978,7 @@  static CPUReadMemoryFunc *pcnet_mmio_read[] = {
 static void pcnet_mmio_map(PCIDevice *pci_dev, int region_num,
                             uint32_t addr, uint32_t size, int type)
 {
-    PCIPCNetState *d = (PCIPCNetState *)pci_dev;
+    PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev);

 #ifdef PCNET_DEBUG_IO
     printf("pcnet_mmio_map addr=0x%08x 0x%08x\n", addr, size);
@@ -2008,7 +2008,7 @@  static void pci_pcnet_cleanup(VLANClientState *vc)

 static int pci_pcnet_uninit(PCIDevice *dev)
 {
-    PCIPCNetState *d = (PCIPCNetState *)dev;
+    PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev);

     cpu_unregister_io_memory(d->state.mmio_index);

@@ -2017,7 +2017,7 @@  static int pci_pcnet_uninit(PCIDevice *dev)

 static void pci_pcnet_init(PCIDevice *pci_dev)
 {
-    PCIPCNetState *d = (PCIPCNetState *)pci_dev;
+    PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev);
     PCNetState *s = &d->state;
     uint8_t *pci_conf;