From nobody Thu Nov 6 10:20:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540474704450331.38729387667433; Thu, 25 Oct 2018 06:38:24 -0700 (PDT) Received: from localhost ([::1]:54500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFfqB-0005CR-3o for importer@patchew.org; Thu, 25 Oct 2018 09:38:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFfmp-00026L-4o for qemu-devel@nongnu.org; Thu, 25 Oct 2018 09:34:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFfm8-0007U9-Ay for qemu-devel@nongnu.org; Thu, 25 Oct 2018 09:34:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFfm4-0007Rf-Le; Thu, 25 Oct 2018 09:34:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FD93308429D; Thu, 25 Oct 2018 13:34:07 +0000 (UTC) Received: from localhost (unknown [10.33.36.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC5E55C21B; Thu, 25 Oct 2018 13:34:00 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Thu, 25 Oct 2018 10:32:26 -0300 Message-Id: <20181025133301.16578-9-ehabkost@redhat.com> In-Reply-To: <20181025133301.16578-1-ehabkost@redhat.com> References: <20181025133301.16578-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 25 Oct 2018 13:34:07 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL v2 08/43] hw/sh4/sh_pci: Use DeviceState::realize rather than SysBusDevice::init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , libvir-list@redhat.com, Jason Wang , Mark Cave-Ayland , Markus Armbruster , Max Filippov , "Edgar E. Iglesias" , Rob Herring , Alexander Graf , Richard Henderson , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , Alistair Francis , qemu-arm@nongnu.org, Paolo Bonzini , David Gibson , Xiao Guangrong , Peter Crosthwaite , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Igor Mammedov , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Move from the legacy SysBusDevice::init method to using DeviceState::realiz= e. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20181002212522.23303-6-f4bug@amsat.org> Reviewed-by: Peter Maydell Signed-off-by: Eduardo Habkost --- hw/sh4/sh_pci.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c index 4ec2e35500..379d0685ed 100644 --- a/hw/sh4/sh_pci.c +++ b/hw/sh4/sh_pci.c @@ -120,16 +120,15 @@ static void sh_pci_set_irq(void *opaque, int irq_num,= int level) qemu_set_irq(pic[irq_num], level); } =20 -static int sh_pci_device_init(SysBusDevice *dev) +static void sh_pci_device_realize(DeviceState *dev, Error **errp) { - PCIHostState *phb; - SHPCIState *s; + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + SHPCIState *s =3D SH_PCI_HOST_BRIDGE(dev); + PCIHostState *phb =3D PCI_HOST_BRIDGE(s); int i; =20 - s =3D SH_PCI_HOST_BRIDGE(dev); - phb =3D PCI_HOST_BRIDGE(s); for (i =3D 0; i < 4; i++) { - sysbus_init_irq(dev, &s->irq[i]); + sysbus_init_irq(sbd, &s->irq[i]); } phb->bus =3D pci_register_root_bus(DEVICE(dev), "pci", sh_pci_set_irq, sh_pci_map_irq, @@ -143,13 +142,12 @@ static int sh_pci_device_init(SysBusDevice *dev) &s->memconfig_p4, 0, 0x224); memory_region_init_alias(&s->isa, OBJECT(s), "sh_pci.isa", get_system_io(), 0, 0x40000); - sysbus_init_mmio(dev, &s->memconfig_p4); - sysbus_init_mmio(dev, &s->memconfig_a7); + sysbus_init_mmio(sbd, &s->memconfig_p4); + sysbus_init_mmio(sbd, &s->memconfig_a7); s->iobr =3D 0xfe240000; memory_region_add_subregion(get_system_memory(), s->iobr, &s->isa); =20 s->dev =3D pci_create_simple(phb->bus, PCI_DEVFN(0, 0), "sh_pci_host"); - return 0; } =20 static void sh_pci_host_realize(PCIDevice *d, Error **errp) @@ -187,9 +185,9 @@ static const TypeInfo sh_pci_host_info =3D { =20 static void sh_pci_device_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *sdc =3D SYS_BUS_DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - sdc->init =3D sh_pci_device_init; + dc->realize =3D sh_pci_device_realize; } =20 static const TypeInfo sh_pci_device_info =3D { --=20 2.18.0.rc1.1.g3f1ff2140