Received: from eggs.gnu.org ([2001:4830:134:3::10]:41634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6Lu4-0001DN-35 for qemu-devel@nongnu.org; Mon, 05 Aug 2013 10:37:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6Ltt-00035u-Vk for qemu-devel@nongnu.org; Mon, 05 Aug 2013 10:36:56 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 5 Aug 2013 16:36:41 +0200 Message-Id: <1375713401-24848-3-git-send-email-afaerber@suse.de> In-Reply-To: <1375713401-24848-1-git-send-email-afaerber@suse.de> References: <1375713401-24848-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-1.6 v2 2/2] pci-bridge: Move common class initializations to base type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexander Graf , "open list:New World" , Gerd Hoffmann , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" 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 Signed-off-by: Andreas F=C3=A4rber --- 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(ObjectClas= s *klass, void *data) PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 k->init =3D dec_pci_bridge_initfn; - k->exit =3D pci_bridge_exitfn; k->vendor_id =3D PCI_VENDOR_ID_DEC; k->device_id =3D PCI_DEVICE_ID_DEC_21154; - k->config_write =3D pci_bridge_write_config; - k->is_bridge =3D 1; dc->desc =3D "DEC 21154 PCI-PCI bridge"; - dc->reset =3D pci_bridge_reset; dc->vmsd =3D &vmstate_pci_device; } =20 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 =3D PCI_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - k->is_bridge =3D 1; k->vendor_id =3D PCI_VENDOR_ID_INTEL; k->device_id =3D PCI_DEVICE_ID_INTEL_82801BA_11; k->revision =3D ICH9_D2P_A2_REVISION; k->init =3D i82801b11_bridge_initfn; - k->config_write =3D pci_bridge_write_config; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); } =20 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, vo= id *data) PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 k->is_express =3D 1; - k->is_bridge =3D 1; k->config_write =3D ioh3420_write_config; k->init =3D ioh3420_initfn; k->exit =3D ioh3420_exitfn; diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_de= v.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 *kl= ass, void *data) k->vendor_id =3D PCI_VENDOR_ID_REDHAT; k->device_id =3D PCI_DEVICE_ID_REDHAT_BRIDGE; k->class_id =3D PCI_CLASS_BRIDGE_PCI; - k->is_bridge =3D 1, dc->desc =3D "Standard PCI Bridge"; dc->reset =3D qdev_pci_bridge_dev_reset; dc->props =3D pci_bridge_dev_properties; diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_d= ownstream.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 =3D PCI_DEVICE_CLASS(klass); =20 k->is_express =3D 1; - k->is_bridge =3D 1; k->config_write =3D xio3130_downstream_write_config; k->init =3D xio3130_downstream_initfn; k->exit =3D xio3130_downstream_exitfn; diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_ups= tream.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 =3D PCI_DEVICE_CLASS(klass); =20 k->is_express =3D 1; - k->is_bridge =3D 1; k->config_write =3D xio3130_upstream_write_config; k->init =3D xio3130_upstream_initfn; k->exit =3D 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 =3D PCI_DEVICE_CLASS(klass); =20 k->init =3D apb_pci_bridge_initfn; - k->exit =3D pci_bridge_exitfn; k->vendor_id =3D PCI_VENDOR_ID_SUN; k->device_id =3D PCI_DEVICE_ID_SUN_SIMBA; k->revision =3D 0x11; - k->config_write =3D pci_bridge_write_config; - k->is_bridge =3D 1; set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->reset =3D pci_bridge_reset; dc->vmsd =3D &vmstate_pci_device; } =20 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 =3D bus_name; } =20 +static void pci_bridge_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + PCIDeviceClass *pdc =3D PCI_DEVICE_CLASS(oc); + + pdc->is_bridge =3D 1; + pdc->exit =3D pci_bridge_exitfn; + pdc->config_write =3D pci_bridge_write_config; + dc->reset =3D pci_bridge_reset; +} + static const TypeInfo pci_bridge_type_info =3D { .name =3D TYPE_PCI_BRIDGE, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCIBridge), .abstract =3D true, + .class_init =3D pci_bridge_class_init, }; =20 static void pci_bridge_register_types(void) --=20 1.8.1.4