Patchwork [v2,15/30] isa/*: QOM casting sweep

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

Comments

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

Use standard QOM cast macros. Remove usage of DO_UPCAST and
direct -> style upcasting.

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

 hw/isa/i82378.c   | 8 ++++----
 hw/isa/lpc_ich9.c | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Patch

diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index a24cb98..d6fef8c 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -159,8 +159,7 @@  static void i82378_request_out0_irq(void *opaque, int irq, int level)
 
 static void i82378_request_pic_irq(void *opaque, int irq, int level)
 {
-    DeviceState *dev = opaque;
-    PCIDevice *pci = DO_UPCAST(PCIDevice, qdev, dev);
+    PCIDevice *pci = PCI_DEVICE(opaque);
     PCIi82378State *s = DO_UPCAST(PCIi82378State, pci_dev, pci);
 
     qemu_set_irq(s->state.i8259[irq], level);
@@ -210,6 +209,7 @@  static void i82378_init(DeviceState *dev, I82378State *s)
 static int pci_i82378_init(PCIDevice *dev)
 {
     PCIi82378State *pci = DO_UPCAST(PCIi82378State, pci_dev, dev);
+    DeviceState *d = DEVICE(pci);
     I82378State *s = &pci->state;
     uint8_t *pci_conf;
 
@@ -233,9 +233,9 @@  static int pci_i82378_init(PCIDevice *dev)
     pci_set_long(pci_conf + PCI_BASE_ADDRESS_0, pci->isa_io_base);
 
     isa_mem_base = pci->isa_mem_base;
-    isa_bus_new(&dev->qdev, pci_address_space_io(dev));
+    isa_bus_new(d, pci_address_space_io(dev));
 
-    i82378_init(&dev->qdev, s);
+    i82378_init(d, s);
 
     return 0;
 }
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 667e882..497ced1 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -277,7 +277,7 @@  void ich9_lpc_set_irq(void *opaque, int pirq, int level)
  */
 int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx)
 {
-    BusState *bus = qdev_get_parent_bus(&pci_dev->qdev);
+    BusState *bus = qdev_get_parent_bus(DEVICE(pci_dev));
     PCIBus *pci_bus = PCI_BUS(bus);
     PCIDevice *lpc_pdev =
             pci_bus->devices[PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC)];
@@ -364,7 +364,7 @@  void ich9_lpc_pm_init(PCIDevice *lpc_pci)
     sci_irq = qemu_allocate_irqs(ich9_set_sci, lpc, 1);
     ich9_pm_init(lpc_pci, &lpc->pm, sci_irq[0]);
 
-    ich9_lpc_reset(&lpc->d.qdev);
+    ich9_lpc_reset(DEVICE(lpc));
 }
 
 /* APM */
@@ -529,7 +529,7 @@  static int ich9_lpc_initfn(PCIDevice *d)
     ICH9LPCState *lpc = ICH9_LPC_DEVICE(d);
     ISABus *isa_bus;
 
-    isa_bus = isa_bus_new(&d->qdev, get_system_io());
+    isa_bus = isa_bus_new(DEVICE(d), get_system_io());
 
     pci_set_long(d->wmask + ICH9_LPC_PMBASE,
                  ICH9_LPC_PMBASE_BASE_ADDRESS_MASK);