From d67628c5bd5e23216c709f9c0c08beb32357aab4 Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Tue, 25 Aug 2020 14:51:47 -0700 Subject: [PATCH] xbox: Replace qdev_create with qdev_new See "qdev: New qdev_new(), qdev_realize(), etc." for more info. --- hw/xbox/smbus_adm1032.c | 9 +++++---- hw/xbox/smbus_cx25871.c | 9 +++++---- hw/xbox/smbus_xbox_smc.c | 8 ++++---- hw/xbox/xbox_pci.c | 9 ++++----- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/hw/xbox/smbus_adm1032.c b/hw/xbox/smbus_adm1032.c index 7ad891f113..7abeb0a5f6 100644 --- a/hw/xbox/smbus_adm1032.c +++ b/hw/xbox/smbus_adm1032.c @@ -28,6 +28,7 @@ #include "hw/i2c/i2c.h" #include "hw/i2c/smbus_slave.h" #include "smbus.h" +#include "qapi/error.h" #define TYPE_SMBUS_ADM1032 "smbus-adm1032" #define SMBUS_ADM1032(obj) OBJECT_CHECK(SMBusADM1032Device, (obj), TYPE_SMBUS_ADM1032) @@ -114,8 +115,8 @@ type_init(smbus_adm1032_register_devices) void smbus_adm1032_init(I2CBus *smbus, int address) { - DeviceState *tm; - tm = qdev_create((BusState *)smbus, TYPE_SMBUS_ADM1032); - qdev_prop_set_uint8(tm, "address", address); - qdev_init_nofail(tm); + DeviceState *dev; + dev = qdev_new(TYPE_SMBUS_ADM1032); + qdev_prop_set_uint8(dev, "address", address); + qdev_realize_and_unref(dev, (BusState *)smbus, &error_fatal); } diff --git a/hw/xbox/smbus_cx25871.c b/hw/xbox/smbus_cx25871.c index bacacc658a..ccd7d48406 100644 --- a/hw/xbox/smbus_cx25871.c +++ b/hw/xbox/smbus_cx25871.c @@ -28,6 +28,7 @@ #include "hw/i2c/i2c.h" #include "hw/i2c/smbus_slave.h" #include "smbus.h" +#include "qapi/error.h" #define TYPE_SMBUS_CX25871 "smbus-cx25871" #define SMBUS_CX25871(obj) OBJECT_CHECK(SMBusCX25871Device, (obj), TYPE_SMBUS_CX25871) @@ -111,8 +112,8 @@ type_init(smbus_cx25871_register_devices) void smbus_cx25871_init(I2CBus *smbus, int address) { - DeviceState *cx; - cx = qdev_create((BusState *)smbus, TYPE_SMBUS_CX25871); - qdev_prop_set_uint8(cx, "address", address); - qdev_init_nofail(cx); + DeviceState *dev; + dev = qdev_new(TYPE_SMBUS_CX25871); + qdev_prop_set_uint8(dev, "address", address); + qdev_realize_and_unref(dev, (BusState *)smbus, &error_fatal); } diff --git a/hw/xbox/smbus_xbox_smc.c b/hw/xbox/smbus_xbox_smc.c index 261ab53c42..733ff0cc79 100644 --- a/hw/xbox/smbus_xbox_smc.c +++ b/hw/xbox/smbus_xbox_smc.c @@ -289,10 +289,10 @@ type_init(smbus_smc_register_devices) void smbus_xbox_smc_init(I2CBus *smbus, int address) { - DeviceState *smc; - smc = qdev_create((BusState *)smbus, TYPE_XBOX_SMC); - qdev_prop_set_uint8(smc, "address", address); - qdev_init_nofail(smc); + DeviceState *dev; + dev = qdev_new(TYPE_XBOX_SMC); + qdev_prop_set_uint8(dev, "address", address); + qdev_realize_and_unref(dev, (BusState *)smbus, &error_fatal); } static void xbox_assert_extsmi(void) diff --git a/hw/xbox/xbox_pci.c b/hw/xbox/xbox_pci.c index a1db941d63..17e472f6fb 100644 --- a/hw/xbox/xbox_pci.c +++ b/hw/xbox/xbox_pci.c @@ -158,13 +158,12 @@ void xbox_pci_init(qemu_irq *pic, XBOX_PCIState *bridge_state; /* pci host bus */ - host = qdev_create(NULL, "xbox-pcihost"); + host = qdev_new("xbox-pcihost"); host_state = PCI_HOST_BRIDGE(host); - - host_bus = pci_root_bus_new(host, NULL, - pci_memory, address_space_io, 0, TYPE_PCI_BUS); + host_bus = pci_root_bus_new(host, NULL, pci_memory, + address_space_io, 0, TYPE_PCI_BUS); host_state->bus = host_bus; - qdev_init_nofail(host); + sysbus_realize_and_unref(SYS_BUS_DEVICE(host), &error_fatal); bridge = pci_create_simple_multifunction(host_bus, PCI_DEVFN(0, 0), true, "xbox-pci");