From nobody Mon Feb 9 16:55:16 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592254597; cv=none; d=zohomail.com; s=zohoarc; b=TWK5r3vV4XIkrJmstE2RZuHvlTDCg4ZU4c+XId9tDk522uj8okuKW7RNLkeS+Qmwv5Uuo/vwVWe6NanlXn5pOJRZ38Ksq3HHLGsqaTKyWslHDE5GokC9hY2fpw8WvRWXsAvBoHDH4gDxk/Dz/exvpawsZKF+7EQcw5hjkU9LhW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592254597; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wxoB6zjGP3IpdR4aA2Iu30y9UUtCe6nX/xPF41E2KRQ=; b=nQYnZ95GUH55uTBvpMuhwJUfcZy1DW9UAlGpmd9T4oEQ2F1gRbEHJ3aUumeE06EynbVXB5ECiqPElVLU7Zy1a/g5Uf0dqNdE1urrjZeLf2lreG17vBZlFVEf9ZHgZNbU8/8+dfpV8Ln33erSlZpeW8vQt+uRH3Z/JuBDzwrSKBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592254597376162.2698073019758; Mon, 15 Jun 2020 13:56:37 -0700 (PDT) Received: from localhost ([::1]:38098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkw9j-0002s8-U8 for importer@patchew.org; Mon, 15 Jun 2020 16:56:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkvuR-0003Dw-76 for qemu-devel@nongnu.org; Mon, 15 Jun 2020 16:40:47 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:36170 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jkvuK-0000Za-2M for qemu-devel@nongnu.org; Mon, 15 Jun 2020 16:40:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-223-kbSpv9n8NpikGekStSCs4w-1; Mon, 15 Jun 2020 16:40:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90ADC5AEC8; Mon, 15 Jun 2020 20:40:34 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E7B8F7CAA0; Mon, 15 Jun 2020 20:40:32 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B10A81133023; Mon, 15 Jun 2020 22:40:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592253639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wxoB6zjGP3IpdR4aA2Iu30y9UUtCe6nX/xPF41E2KRQ=; b=GjDEsBnSXOA4iGQfBBGG+C4kVTHNizGD7sZMH95zd4KukXiZQFqzix2k01MIQbL0BKu2sN 8Kv8N/RZkWJ3CddaRuA9LwNm7ppIr1phGDlwLvs4Kr+EpoTusmHQF4T1fNCve4N0AhupeL N9rg9ZcL3w3Rjvv5Kr1b38iqbMM1tYg= X-MC-Unique: kbSpv9n8NpikGekStSCs4w-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 41/84] pci: Convert uses of pci_create() etc. with Coccinelle Date: Mon, 15 Jun 2020 22:39:25 +0200 Message-Id: <20200615204008.3069956-42-armbru@redhat.com> In-Reply-To: <20200615204008.3069956-1-armbru@redhat.com> References: <20200615204008.3069956-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/15 15:33:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Replace dev =3D pci_create(bus, type_name); ... qdev_init_nofail(dev); by dev =3D pci_new(type_name); ... pci_realize_and_unref(dev, bus, &error_fatal); and similarly for pci_create_multifunction(). Recent commit "qdev: New qdev_new(), qdev_realize(), etc." explains why. Coccinelle script: @@ expression dev, bus, expr; expression list args; @@ - dev =3D pci_create(bus, args); + dev =3D pci_new(args); ... when !=3D dev =3D expr - qdev_init_nofail(&dev->qdev); + pci_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; expression d; @@ - dev =3D pci_create(bus, args); + dev =3D pci_new(args); ( d =3D &dev->qdev; | d =3D DEVICE(dev); ) ... when !=3D dev =3D expr - qdev_init_nofail(d); + pci_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev =3D pci_create(bus, args); + dev =3D pci_new(args); ... when !=3D dev =3D expr - qdev_init_nofail(DEVICE(dev)); + pci_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev =3D DEVICE(pci_create(bus, args)); + PCIDevice *pci_dev; // TODO move + pci_dev =3D pci_new(args); + dev =3D DEVICE(pci_dev); ... when !=3D dev =3D expr - qdev_init_nofail(dev); + pci_realize_and_unref(pci_dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev =3D pci_create_multifunction(bus, args); + dev =3D pci_new_multifunction(args); ... when !=3D dev =3D expr - qdev_init_nofail(&dev->qdev); + pci_realize_and_unref(dev, bus, &error_fatal); @@ expression bus, expr; expression list args; identifier dev; @@ - PCIDevice *dev =3D pci_create_multifunction(bus, args); + PCIDevice *dev =3D pci_new_multifunction(args); ... when !=3D dev =3D expr - qdev_init_nofail(&dev->qdev); + pci_realize_and_unref(dev, bus, &error_fatal); @@ expression dev, bus, expr; expression list args; @@ - dev =3D pci_create_multifunction(bus, args); + dev =3D pci_new_multifunction(args); ... when !=3D dev =3D expr - qdev_init_nofail(DEVICE(dev)); + pci_realize_and_unref(dev, bus, &error_fatal); Missing #include "qapi/error.h" added manually, whitespace changes minimized manually, @pci_dev declarations moved manually. Cc: Michael S. Tsirkin Cc: Marcel Apfelbaum Signed-off-by: Markus Armbruster Reviewed-by: Paolo Bonzini Message-Id: <20200610053247.1583243-16-armbru@redhat.com> Reviewed-by: Michael S. Tsirkin --- hw/acpi/piix4.c | 6 ++++-- hw/i386/pc_q35.c | 10 +++++----- hw/isa/vt82c686.c | 13 +++++++------ hw/mips/fuloong2e.c | 6 ++++-- hw/pci-bridge/dec.c | 6 +++--- hw/pci-host/bonito.c | 4 ++-- hw/pci-host/sabre.c | 13 +++++++------ hw/pci/pci.c | 8 ++++---- hw/ppc/mac_newworld.c | 4 ++-- hw/ppc/mac_oldworld.c | 4 ++-- hw/sparc64/sun4u.c | 8 ++++---- 11 files changed, 44 insertions(+), 38 deletions(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index e27f57195a..1262abc77a 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -514,10 +514,12 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_= t smb_io_base, qemu_irq sci_irq, qemu_irq smi_irq, int smm_enabled, DeviceState **piix4_pm) { + PCIDevice *pci_dev; DeviceState *dev; PIIX4PMState *s; =20 - dev =3D DEVICE(pci_create(bus, devfn, TYPE_PIIX4_PM)); + pci_dev =3D pci_new(devfn, TYPE_PIIX4_PM); + dev =3D DEVICE(pci_dev); qdev_prop_set_uint32(dev, "smb_io_base", smb_io_base); if (piix4_pm) { *piix4_pm =3D dev; @@ -531,7 +533,7 @@ I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t = smb_io_base, s->use_acpi_pci_hotplug =3D false; } =20 - qdev_init_nofail(dev); + pci_realize_and_unref(pci_dev, bus, &error_fatal); =20 return s->smb.smbus; } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 59307d91e2..a6b6add2ef 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -100,16 +100,16 @@ static int ehci_create_ich9_with_companions(PCIBus *b= us, int slot) return -1; } =20 - ehci =3D pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name); - qdev_init_nofail(&ehci->qdev); + ehci =3D pci_new_multifunction(PCI_DEVFN(slot, 7), true, name); + pci_realize_and_unref(ehci, bus, &error_fatal); usbbus =3D QLIST_FIRST(&ehci->qdev.child_bus); =20 for (i =3D 0; i < 3; i++) { - uhci =3D pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].fun= c), - true, comp[i].name); + uhci =3D pci_new_multifunction(PCI_DEVFN(slot, comp[i].func), true, + comp[i].name); qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name); qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port); - qdev_init_nofail(&uhci->qdev); + pci_realize_and_unref(uhci, bus, &error_fatal); } return 0; } diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index fac4e56b7d..18160ca445 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -23,6 +23,7 @@ #include "hw/isa/apm.h" #include "hw/acpi/acpi.h" #include "hw/i2c/pm_smbus.h" +#include "qapi/error.h" #include "qemu/module.h" #include "qemu/timer.h" #include "exec/address-spaces.h" @@ -276,8 +277,8 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn) { PCIDevice *dev; =20 - dev =3D pci_create(bus, devfn, TYPE_VT82C686B_AC97_DEVICE); - qdev_init_nofail(&dev->qdev); + dev =3D pci_new(devfn, TYPE_VT82C686B_AC97_DEVICE); + pci_realize_and_unref(dev, bus, &error_fatal); } =20 static void via_ac97_class_init(ObjectClass *klass, void *data) @@ -320,8 +321,8 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn) { PCIDevice *dev; =20 - dev =3D pci_create(bus, devfn, TYPE_VT82C686B_MC97_DEVICE); - qdev_init_nofail(&dev->qdev); + dev =3D pci_new(devfn, TYPE_VT82C686B_MC97_DEVICE); + pci_realize_and_unref(dev, bus, &error_fatal); } =20 static void via_mc97_class_init(ObjectClass *klass, void *data) @@ -388,12 +389,12 @@ I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uin= t32_t smb_io_base, PCIDevice *dev; VT686PMState *s; =20 - dev =3D pci_create(bus, devfn, TYPE_VT82C686B_PM_DEVICE); + dev =3D pci_new(devfn, TYPE_VT82C686B_PM_DEVICE); qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base); =20 s =3D VT82C686B_PM_DEVICE(dev); =20 - qdev_init_nofail(&dev->qdev); + pci_realize_and_unref(dev, bus, &error_fatal); =20 return s->smb.smbus; } diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 7a65166cf0..8ca31e5162 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -297,6 +297,7 @@ static void mips_fuloong2e_init(MachineState *machine) long bios_size; uint8_t *spd_data; int64_t kernel_entry; + PCIDevice *pci_dev; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; @@ -367,10 +368,11 @@ static void mips_fuloong2e_init(MachineState *machine) =20 /* GPU */ if (vga_interface_type !=3D VGA_NONE) { - dev =3D DEVICE(pci_create(pci_bus, -1, "ati-vga")); + pci_dev =3D pci_new(-1, "ati-vga"); + dev =3D DEVICE(pci_dev); qdev_prop_set_uint32(dev, "vgamem_mb", 16); qdev_prop_set_uint16(dev, "x-device-id", 0x5159); - qdev_init_nofail(dev); + pci_realize_and_unref(pci_dev, pci_bus, &error_fatal); } =20 /* Populate SPD eeprom data */ diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c index 952bc71122..677a310b96 100644 --- a/hw/pci-bridge/dec.c +++ b/hw/pci-bridge/dec.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "dec.h" #include "hw/sysbus.h" +#include "qapi/error.h" #include "qemu/module.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" @@ -81,11 +82,10 @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devf= n) PCIDevice *dev; PCIBridge *br; =20 - dev =3D pci_create_multifunction(parent_bus, devfn, false, - "dec-21154-p2p-bridge"); + dev =3D pci_new_multifunction(devfn, false, "dec-21154-p2p-bridge"); br =3D PCI_BRIDGE(dev); pci_bridge_map_irq(br, "DEC 21154 PCI-PCI bridge", dec_map_irq); - qdev_init_nofail(&dev->qdev); + pci_realize_and_unref(dev, parent_bus, &error_fatal); return pci_bridge_get_sec_bus(br); } =20 diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 546ac84cf4..7bb032f005 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -750,11 +750,11 @@ PCIBus *bonito_init(qemu_irq *pic) pcihost->pic =3D pic; qdev_realize_and_unref(dev, NULL, &error_fatal); =20 - d =3D pci_create(phb->bus, PCI_DEVFN(0, 0), TYPE_PCI_BONITO); + d =3D pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); s =3D PCI_BONITO(d); s->pcihost =3D pcihost; pcihost->pci_dev =3D s; - qdev_init_nofail(DEVICE(d)); + pci_realize_and_unref(d, phb->bus, &error_fatal); =20 return phb->bus; } diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c index 475bcb01d7..0cc68585f8 100644 --- a/hw/pci-host/sabre.c +++ b/hw/pci-host/sabre.c @@ -35,6 +35,7 @@ #include "hw/pci-bridge/simba.h" #include "hw/pci-host/sabre.h" #include "exec/address-spaces.h" +#include "qapi/error.h" #include "qemu/log.h" #include "qemu/module.h" #include "sysemu/runstate.h" @@ -405,17 +406,17 @@ static void sabre_realize(DeviceState *dev, Error **e= rrp) pci_setup_iommu(phb->bus, sabre_pci_dma_iommu, s->iommu); =20 /* APB secondary busses */ - pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 0), true, - TYPE_SIMBA_PCI_BRIDGE); + pci_dev =3D pci_new_multifunction(PCI_DEVFN(1, 0), true, + TYPE_SIMBA_PCI_BRIDGE); s->bridgeB =3D PCI_BRIDGE(pci_dev); pci_bridge_map_irq(s->bridgeB, "pciB", pci_simbaB_map_irq); - qdev_init_nofail(&pci_dev->qdev); + pci_realize_and_unref(pci_dev, phb->bus, &error_fatal); =20 - pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 1), true, - TYPE_SIMBA_PCI_BRIDGE); + pci_dev =3D pci_new_multifunction(PCI_DEVFN(1, 1), true, + TYPE_SIMBA_PCI_BRIDGE); s->bridgeA =3D PCI_BRIDGE(pci_dev); pci_bridge_map_irq(s->bridgeA, "pciA", pci_simbaA_map_irq); - qdev_init_nofail(&pci_dev->qdev); + pci_realize_and_unref(pci_dev, phb->bus, &error_fatal); } =20 static void sabre_init(Object *obj) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 7e759646cf..24f726d4cd 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1953,10 +1953,10 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus = *rootbus, exit(1); } =20 - pci_dev =3D pci_create(bus, devfn, nd->model); + pci_dev =3D pci_new(devfn, nd->model); dev =3D &pci_dev->qdev; qdev_set_nic_properties(dev, nd); - qdev_init_nofail(dev); + pci_realize_and_unref(pci_dev, bus, &error_fatal); g_ptr_array_free(pci_nic_models, true); return pci_dev; } @@ -2199,8 +2199,8 @@ PCIDevice *pci_create_simple_multifunction(PCIBus *bu= s, int devfn, bool multifunction, const char *name) { - PCIDevice *dev =3D pci_create_multifunction(bus, devfn, multifunction,= name); - qdev_init_nofail(&dev->qdev); + PCIDevice *dev =3D pci_new_multifunction(devfn, multifunction, name); + pci_realize_and_unref(dev, bus, &error_fatal); return dev; } =20 diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 2d069dcc59..baa17cdce7 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -375,14 +375,14 @@ static void ppc_core99_init(MachineState *machine) pci_bus =3D PCI_HOST_BRIDGE(uninorth_pci)->bus; =20 /* MacIO */ - macio =3D pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO); + macio =3D pci_new(-1, TYPE_NEWWORLD_MACIO); dev =3D DEVICE(macio); qdev_prop_set_uint64(dev, "frequency", tbfreq); qdev_prop_set_bit(dev, "has-pmu", has_pmu); qdev_prop_set_bit(dev, "has-adb", has_adb); object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic", &error_abort); - qdev_init_nofail(dev); + pci_realize_and_unref(macio, pci_bus, &error_fatal); =20 /* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get(hd, ARRAY_SIZE(hd)); diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index f73ec5f3a9..903483079e 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -278,12 +278,12 @@ static void ppc_heathrow_init(MachineState *machine) ide_drive_get(hd, ARRAY_SIZE(hd)); =20 /* MacIO */ - macio =3D pci_create(pci_bus, -1, TYPE_OLDWORLD_MACIO); + macio =3D pci_new(-1, TYPE_OLDWORLD_MACIO); dev =3D DEVICE(macio); qdev_prop_set_uint64(dev, "frequency", tbfreq); object_property_set_link(OBJECT(macio), OBJECT(pic_dev), "pic", &error_abort); - qdev_init_nofail(dev); + pci_realize_and_unref(macio, pci_bus, &error_fatal); =20 macio_ide =3D MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[0]")); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index ade9c22825..6f29a013ca 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -605,10 +605,10 @@ static void sun4uv_init(MemoryRegion *address_space_m= em, pci_busA->slot_reserved_mask =3D 0xfffffff1; pci_busB->slot_reserved_mask =3D 0xfffffff0; =20 - ebus =3D pci_create_multifunction(pci_busA, PCI_DEVFN(1, 0), true, TYP= E_EBUS); + ebus =3D pci_new_multifunction(PCI_DEVFN(1, 0), true, TYPE_EBUS); qdev_prop_set_uint64(DEVICE(ebus), "console-serial-base", hwdef->console_serial_base); - qdev_init_nofail(DEVICE(ebus)); + pci_realize_and_unref(ebus, pci_busA, &error_fatal); =20 /* Wire up "well-known" ISA IRQs to PBM legacy obio IRQs */ qdev_connect_gpio_out_named(DEVICE(ebus), "isa-irq", 7, @@ -661,9 +661,9 @@ static void sun4uv_init(MemoryRegion *address_space_mem, qemu_macaddr_default_if_unset(&macaddr); } =20 - pci_dev =3D pci_create(pci_busA, PCI_DEVFN(3, 0), "cmd646-ide"); + pci_dev =3D pci_new(PCI_DEVFN(3, 0), "cmd646-ide"); qdev_prop_set_uint32(&pci_dev->qdev, "secondary", 1); - qdev_init_nofail(&pci_dev->qdev); + pci_realize_and_unref(pci_dev, pci_busA, &error_fatal); pci_ide_create_devs(pci_dev); =20 /* Map NVRAM into I/O (ebus) space */ --=20 2.26.2