qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH for-1.6 v2 2/2] pci-bridge: Move common class initiali


From: Andreas Färber
Subject: [Qemu-ppc] [PATCH for-1.6 v2 2/2] pci-bridge: Move common class initializations to base type
Date: Mon, 5 Aug 2013 16:36:41 +0200

Set PCIDeviceClass::is_bridge as well as PCIDeviceClass::config_write(),
PCIDeviceClass::exit() and DeviceClass::reset() defaults directly for
TYPE_PCI_BRIDGE (complements f055e96bd4311d287c0e03faec02a1bdbc351925).

This avoids another pci_bridge_config_write() missing somewhere, unless
explicitly overridden.

Reported-by: Gerd Hoffmann <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
 hw/pci-bridge/dec.c                |  4 ----
 hw/pci-bridge/i82801b11.c          |  2 --
 hw/pci-bridge/ioh3420.c            |  1 -
 hw/pci-bridge/pci_bridge_dev.c     |  1 -
 hw/pci-bridge/xio3130_downstream.c |  1 -
 hw/pci-bridge/xio3130_upstream.c   |  1 -
 hw/pci-host/apb.c                  |  4 ----
 hw/pci/pci_bridge.c                | 12 ++++++++++++
 8 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index e5e3be8..379f9f0 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -62,13 +62,9 @@ static void dec_21154_pci_bridge_class_init(ObjectClass 
*klass, void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->init = dec_pci_bridge_initfn;
-    k->exit = pci_bridge_exitfn;
     k->vendor_id = PCI_VENDOR_ID_DEC;
     k->device_id = PCI_DEVICE_ID_DEC_21154;
-    k->config_write = pci_bridge_write_config;
-    k->is_bridge = 1;
     dc->desc = "DEC 21154 PCI-PCI bridge";
-    dc->reset = pci_bridge_reset;
     dc->vmsd = &vmstate_pci_device;
 }
 
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 14cd7fd..ab0c8e1 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -85,12 +85,10 @@ static void i82801b11_bridge_class_init(ObjectClass *klass, 
void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
     DeviceClass *dc = DEVICE_CLASS(klass);
 
-    k->is_bridge = 1;
     k->vendor_id = PCI_VENDOR_ID_INTEL;
     k->device_id = PCI_DEVICE_ID_INTEL_82801BA_11;
     k->revision = ICH9_D2P_A2_REVISION;
     k->init = i82801b11_bridge_initfn;
-    k->config_write = pci_bridge_write_config;
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
 }
 
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index 0f7f209..2748b06 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -200,7 +200,6 @@ static void ioh3420_class_init(ObjectClass *klass, void 
*data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->is_express = 1;
-    k->is_bridge = 1;
     k->config_write = ioh3420_write_config;
     k->init = ioh3420_initfn;
     k->exit = ioh3420_exitfn;
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index a9392c7..716d0af 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -142,7 +142,6 @@ static void pci_bridge_dev_class_init(ObjectClass *klass, 
void *data)
     k->vendor_id = PCI_VENDOR_ID_REDHAT;
     k->device_id = PCI_DEVICE_ID_REDHAT_BRIDGE;
     k->class_id = PCI_CLASS_BRIDGE_PCI;
-    k->is_bridge = 1,
     dc->desc = "Standard PCI Bridge";
     dc->reset = qdev_pci_bridge_dev_reset;
     dc->props = pci_bridge_dev_properties;
diff --git a/hw/pci-bridge/xio3130_downstream.c 
b/hw/pci-bridge/xio3130_downstream.c
index 94f9781..07da9bf 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -167,7 +167,6 @@ static void xio3130_downstream_class_init(ObjectClass 
*klass, void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->is_express = 1;
-    k->is_bridge = 1;
     k->config_write = xio3130_downstream_write_config;
     k->init = xio3130_downstream_initfn;
     k->exit = xio3130_downstream_exitfn;
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
index 59f97f6..def08c8 100644
--- a/hw/pci-bridge/xio3130_upstream.c
+++ b/hw/pci-bridge/xio3130_upstream.c
@@ -146,7 +146,6 @@ static void xio3130_upstream_class_init(ObjectClass *klass, 
void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->is_express = 1;
-    k->is_bridge = 1;
     k->config_write = xio3130_upstream_write_config;
     k->init = xio3130_upstream_initfn;
     k->exit = xio3130_upstream_exitfn;
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 92f289f..1cb2ef4 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -553,14 +553,10 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, 
void *data)
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->init = apb_pci_bridge_initfn;
-    k->exit = pci_bridge_exitfn;
     k->vendor_id = PCI_VENDOR_ID_SUN;
     k->device_id = PCI_DEVICE_ID_SUN_SIMBA;
     k->revision = 0x11;
-    k->config_write = pci_bridge_write_config;
-    k->is_bridge = 1;
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
-    dc->reset = pci_bridge_reset;
     dc->vmsd = &vmstate_pci_device;
 }
 
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index a90671d..23a5c7d 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -405,11 +405,23 @@ void pci_bridge_map_irq(PCIBridge *br, const char* 
bus_name,
     br->bus_name = bus_name;
 }
 
+static void pci_bridge_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+    PCIDeviceClass *pdc = PCI_DEVICE_CLASS(oc);
+
+    pdc->is_bridge = 1;
+    pdc->exit = pci_bridge_exitfn;
+    pdc->config_write = pci_bridge_write_config;
+    dc->reset = pci_bridge_reset;
+}
+
 static const TypeInfo pci_bridge_type_info = {
     .name = TYPE_PCI_BRIDGE,
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIBridge),
     .abstract = true,
+    .class_init = pci_bridge_class_init,
 };
 
 static void pci_bridge_register_types(void)
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]