Patchwork [for,master,2/3] pci_host: remove PCIHostState::busdev.

login
register
mail settings
Submitter Isaku Yamahata
Date July 27, 2010, 6:23 a.m.
Message ID <4aaf13772d51847417a7e24ec120d885a45ccb20.1280211617.git.yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/59974/
State New
Headers show

Comments

Isaku Yamahata - July 27, 2010, 6:23 a.m.
It is mostly unused expcet i440fx and bonito.
So remove the member.

Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/bonito.c   |   11 +++++++----
 hw/pci_host.h |    1 -
 hw/piix_pci.c |   11 +++++++----
 3 files changed, 14 insertions(+), 9 deletions(-)

Patch

diff --git a/hw/bonito.c b/hw/bonito.c
index dcf0311..41dfb70 100644
--- a/hw/bonito.c
+++ b/hw/bonito.c
@@ -176,12 +176,15 @@ 
 #define PCI_ADDR(busno,devno,funno,regno)  \
     ((((busno)<<16)&0xff0000) + (((devno)<<11)&0xf800) + (((funno)<<8)&0x700) + (regno))
 
-typedef PCIHostState BonitoState;
+typedef struct {
+    SysBusDevice busdev;
+    PCIHostState pci;
+} BonitoState;
 
 typedef struct PCIBonitoState
 {
     PCIDevice dev;
-    BonitoState *pcihost;
+    PCIHostState *pcihost;
     uint32_t regs[BONITO_REGS];
 
     struct bonldma {
@@ -773,12 +776,12 @@  PCIBus *bonito_init(qemu_irq *pic)
     pcihost = FROM_SYSBUS(BonitoState, sysbus_from_qdev(dev));
     b = pci_register_bus(&pcihost->busdev.qdev, "pci", pci_bonito_set_irq,
                          pci_bonito_map_irq, pic, 0x28, 32);
-    pcihost->bus = b;
+    pcihost->pci.bus = b;
     qdev_init_nofail(dev);
 
     d = pci_create_simple(b, PCI_DEVFN(0, 0), "Bonito");
     s = DO_UPCAST(PCIBonitoState, dev, d);
-    s->pcihost = pcihost;
+    s->pcihost = &pcihost->pci;
     bonito_state = s;
 
     return b;
diff --git a/hw/pci_host.h b/hw/pci_host.h
index bd8ede8..46d1379 100644
--- a/hw/pci_host.h
+++ b/hw/pci_host.h
@@ -32,7 +32,6 @@ 
 #include "rwhandler.h"
 
 struct PCIHostState {
-    SysBusDevice busdev;
     ReadWriteHandler conf_noswap_handler;
     ReadWriteHandler conf_handler;
     ReadWriteHandler data_noswap_handler;
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index f152a0f..e0f67e5 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -34,7 +34,10 @@ 
  * http://download.intel.com/design/chipsets/datashts/29054901.pdf
  */
 
-typedef PCIHostState I440FXState;
+typedef struct {
+    SysBusDevice busdev;
+    PCIHostState pci;
+} I440FXState;
 
 typedef struct PIIX3State {
     PCIDevice dev;
@@ -194,9 +197,9 @@  static int i440fx_pcihost_initfn(SysBusDevice *dev)
 {
     I440FXState *s = FROM_SYSBUS(I440FXState, dev);
 
-    pci_host_conf_register_ioport(0xcf8, s);
+    pci_host_conf_register_ioport(0xcf8, &s->pci);
 
-    pci_host_data_register_ioport(0xcfc, s);
+    pci_host_data_register_ioport(0xcfc, &s->pci);
     return 0;
 }
 
@@ -226,7 +229,7 @@  PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *
     dev = qdev_create(NULL, "i440FX-pcihost");
     s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev));
     b = pci_bus_new(&s->busdev.qdev, NULL, 0);
-    s->bus = b;
+    s->pci.bus = b;
     qdev_init_nofail(dev);
 
     d = pci_create_simple(b, 0, "i440FX");