Convert the *_orphan() device-creation calls in the smaller
hw/arm/aspeed_* board files and the shared aspeed helpers to the new
parented API introduced earlier in this series, so every onboard
device gets a stable path in the composition tree instead of landing
in /machine/unattached with an unstable device[N] name.

The parent for each device is the object that owns its lifetime: the
machine (AspeedMachineState) for board-created I2C peripherals, the
containing SoC device for composite children.  Names follow existing
QOM conventions.

The shared helpers aspeed_create_pca9552(), aspeed_create_pca9554()
and aspeed_soc_uart_realize() gain an Object *parent first argument;
callers in the four large aspeed board files are updated here so
this commit builds standalone, but the direct *_orphan() calls in
those four files are converted in the next commit.

Per-site rationale (reviewers: dispute the modeling here):

hw/arm/aspeed_* boards — per-callsite rationale (62 sites)
============================================================

Common context: all *_i2c_init(AspeedMachineState *bmc) callbacks are invoked
from aspeed_machine_init() (mc->init) via amc->i2c_init(bmc). bmc is the
MachineState → parent = OBJECT(bmc). i2c_slave_create_simple realizes
internally, so no realize-call change needed. i2c_slave_new pairs with
qdev_realize (i2c_slave_realize does not exist).

File:Line                                Old call                              
Parent          Name          Notes
---------------------------------------  ------------------------------------  
--------------  ------------  ------------------------------------------
aspeed_ast1040_evb.c:59                  i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105"      board i2c_init callback
aspeed_ast10x0_evb.c:77                  i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105"      board i2c_init callback
aspeed_ast2400_palmetto.c:40             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "rtc"         ds1338 RTC
aspeed_ast2400_palmetto.c:46             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp423"      single instance
aspeed_ast2400_quanta-q71l.c:36          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105[*]"   3× tmp105 → auto-index
aspeed_ast2400_quanta-q71l.c:37          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105[*]"
aspeed_ast2400_quanta-q71l.c:38          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105[*]"
aspeed_ast2400_quanta-q71l.c:44          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"  pca954x muxes
aspeed_ast2400_quanta-q71l.c:45          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast2400_quanta-q71l.c:50          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast2400_supermicrox11.c:40        i2c_slave_create_simple_orphan        
OBJECT(bmc)     "rtc"         ds1338
aspeed_ast2400_supermicrox11.c:46        i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp423"
aspeed_ast2500_evb.c:37                  i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105"
aspeed_ast2500_g220a.c:35                i2c_slave_create_simple_orphan        
OBJECT(bmc)     "emc1413[*]"  3× emc1413
aspeed_ast2500_g220a.c:41                i2c_slave_create_simple_orphan        
OBJECT(bmc)     "emc1413[*]"
aspeed_ast2500_g220a.c:47                i2c_slave_create_simple_orphan        
OBJECT(bmc)     "emc1413[*]"
aspeed_ast2500_romulus.c:33              i2c_slave_create_simple_orphan        
OBJECT(bmc)     "rtc"         ds1338
aspeed_ast2500_supermicro-x11spi.c:36    i2c_slave_create_simple_orphan        
OBJECT(bmc)     "rtc"         ds1338
aspeed_ast2500_supermicro-x11spi.c:42    i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp423"
aspeed_ast2500_tiogapass.c:58            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"   3× tmp421
aspeed_ast2500_tiogapass.c:59            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2500_tiogapass.c:60            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2500_witherspoon.c:47          i2c_slave_new_orphan                  
OBJECT(bmc)     "pca9552[*]"  → i2c_slave_new; realize_and_unref → 
qdev_realize(dev, BUS(bus), ...)
aspeed_ast2500_witherspoon.c:61          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "dps310"
aspeed_ast2500_witherspoon.c:62          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "max31785"
aspeed_ast2500_witherspoon.c:63          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp423[*]"   2× tmp423
aspeed_ast2500_witherspoon.c:64          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp423[*]"
aspeed_ast2500_witherspoon.c:67          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105"
aspeed_ast2500_witherspoon.c:74          i2c_slave_create_simple_orphan        
OBJECT(bmc)     "rtc"         ds1338
aspeed_ast2500_witherspoon.c:78          i2c_slave_new_orphan                  
OBJECT(bmc)     "pca9552[*]"  → i2c_slave_new; realize_and_unref → qdev_realize
aspeed_ast2500_yosemitev2.c:58           i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"   3× tmp421
aspeed_ast2500_yosemitev2.c:59           i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2500_yosemitev2.c:60           i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2600_bletchley.c:38            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"   loop 0..5
aspeed_ast2600_bletchley.c:40            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "pca9552[*]"  loop 0..5
aspeed_ast2600_bletchley.c:41            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "pca9552[*]"  loop 0..5
aspeed_ast2600_bletchley.c:48            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "rtc"         ds1338
aspeed_ast2600_bletchley.c:55            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2600_bletchley.c:58            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2600_bletchley.c:60            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "pca9552[*]"
aspeed_ast2600_bletchley.c:64            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2600_bletchley.c:65            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421[*]"
aspeed_ast2600_bletchley.c:66            i2c_slave_create_simple_orphan        
OBJECT(bmc)     "pca9552[*]"
aspeed_ast2600_evb.c:30                  i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105"
aspeed_ast2600_fby35.c:105               i2c_slave_create_simple_orphan        
OBJECT(bmc)     "lm75[*]"     3× LM75 total
aspeed_ast2600_fby35.c:106               i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp421"
aspeed_ast2600_fby35.c:108               i2c_slave_create_simple_orphan        
OBJECT(bmc)     "adm1272"
aspeed_ast2600_fby35.c:109               i2c_slave_create_simple_orphan        
OBJECT(bmc)     "lm75[*]"
aspeed_ast2600_fby35.c:110               i2c_slave_create_simple_orphan        
OBJECT(bmc)     "lm75[*]"
aspeed_ast2600_gb200nvl.c:57             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"  6× pca9546
aspeed_ast2600_gb200nvl.c:58             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast2600_gb200nvl.c:59             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast2600_gb200nvl.c:60             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast2600_gb200nvl.c:61             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast2600_gb200nvl.c:62             i2c_slave_create_simple_orphan        
OBJECT(bmc)     "i2c-mux[*]"
aspeed_ast27x0_evb.c:27                  i2c_slave_create_simple_orphan        
OBJECT(bmc)     "tmp105"
aspeed_ast27x0-fc.c:112                  i2c_slave_create_simple_orphan        
OBJECT(machine) "tmp105"      ast2700fc_ca35_init(MachineState *machine)
aspeed.c:93                              qdev_new_orphan                       
parent          "sd-card[*]"  static helper sdhci_attach_drive(): threaded
                                                                                
                             Object *parent as first arg; callers pass
                                                                                
                             OBJECT(bmc) from aspeed_machine_init.
                                                                                
                             qdev_realize_and_unref → qdev_realize.
aspeed.c:256                             i2c_slave_create_simple_orphan        
parent          "pca9552[*]"  aspeed_create_pca9552(): threaded Object *parent
                                                                                
                             first arg. Prototype in include/hw/arm/aspeed.h
                                                                                
                             updated. Callers in rainier.c, gb200nvl.c updated
                                                                                
                             to pass OBJECT(bmc).
aspeed.c:262                             i2c_slave_create_simple_orphan        
parent          "pca9554[*]"  aspeed_create_pca9554(): threaded Object *parent
                                                                                
                             first arg. Prototype updated. Callers in
                                                                                
                             gb200nvl.c updated to pass OBJECT(bmc).
aspeed_soc_common.c:84                   qdev_new_orphan                       
OBJECT(s)       "ram-empty"   aspeed_soc_dram_init(AspeedSoCState *s) called
                                                                                
                             from SoC realize (ast2400/2600). Parent = SoC.
                                                                                
                             sysbus_realize_and_unref → sysbus_realize.
aspeed_soc_common.c:131                  qdev_new_orphan                       
parent          "flash[*]"    aspeed_board_init_flashes(): threaded Object
                                                                                
                             *parent first arg. Called from board init
                                                                                
                             (aspeed.c, ast10x0_evb.c, ast27x0-fc.c) — all
                                                                                
                             callers pass OBJECT(bmc)/OBJECT(machine).
                                                                                
                             Prototype in include/hw/arm/aspeed_soc.h updated.
                                                                                
                             qdev_realize_and_unref → qdev_realize.

Threaded-parent helper changes (all callers updated in same diff):
  sdhci_attach_drive()        hw/arm/aspeed.c (static)     — 2 callers in 
aspeed.c
  aspeed_create_pca9552()     hw/arm/aspeed.c + aspeed.h   — 16 callers in 
aspeed_ast2600_rainier.c
  aspeed_create_pca9554()     hw/arm/aspeed.c + aspeed.h   — 3 callers in 
aspeed_ast2600_gb200nvl.c
  aspeed_board_init_flashes() hw/arm/aspeed_soc_common.c + aspeed_soc.h — 8 
callers
                              (aspeed.c ×3, ast10x0_evb.c ×3, ast27x0-fc.c ×2)

Not touched (per instructions): at24c_eeprom_init*(), smbus_eeprom_init*().

orphan_justified = 0

Link: https://lore.kernel.org/qemu-devel/[email protected]/
Assisted-by: Kiro
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/arm/aspeed.c                           | 37 +++++++++++++----------
 hw/arm/aspeed_ast1040_evb.c               |  3 +-
 hw/arm/aspeed_ast10x0_evb.c               |  9 +++---
 hw/arm/aspeed_ast2400_palmetto.c          |  6 ++--
 hw/arm/aspeed_ast2400_quanta-q71l.c       | 18 +++++++----
 hw/arm/aspeed_ast2400_supermicrox11.c     |  6 ++--
 hw/arm/aspeed_ast2500_evb.c               |  5 +--
 hw/arm/aspeed_ast2500_g220a.c             |  9 ++++--
 hw/arm/aspeed_ast2500_romulus.c           |  3 +-
 hw/arm/aspeed_ast2500_supermicro-x11spi.c |  6 ++--
 hw/arm/aspeed_ast2500_tiogapass.c         |  9 ++++--
 hw/arm/aspeed_ast2500_witherspoon.c       | 32 +++++++++++---------
 hw/arm/aspeed_ast2500_yosemitev2.c        |  9 ++++--
 hw/arm/aspeed_ast2600_bletchley.c         | 29 ++++++++++++------
 hw/arm/aspeed_ast2600_evb.c               |  5 +--
 hw/arm/aspeed_ast2600_fby35.c             | 10 +++---
 hw/arm/aspeed_ast2600_gb200nvl.c          | 18 +++++------
 hw/arm/aspeed_ast2600_rainier.c           | 32 ++++++++++----------
 hw/arm/aspeed_ast27x0-fc.c                |  9 ++++--
 hw/arm/aspeed_ast27x0_evb.c               |  3 +-
 hw/arm/aspeed_soc_common.c                | 12 +++++---
 include/hw/arm/aspeed.h                   | 10 +++---
 include/hw/arm/aspeed_soc.h               |  3 +-
 23 files changed, 167 insertions(+), 116 deletions(-)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 4a4c1f1556..2e76e09f8f 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -82,15 +82,16 @@ static void aspeed_reset_secondary(ARMCPU *cpu,
     cpu_set_pc(cs, info->smp_loader_start);
 }
 
-static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
-                               bool boot_emmc)
+static void sdhci_attach_drive(Object *parent, SDHCIState *sdhci,
+                               DriveInfo *dinfo, bool emmc, bool boot_emmc)
 {
         DeviceState *card;
 
         if (!dinfo) {
             return;
         }
-        card = qdev_new_orphan(emmc ? TYPE_EMMC : TYPE_SD_CARD);
+        card = qdev_new(parent, "sd-card[*]",
+                        emmc ? TYPE_EMMC : TYPE_SD_CARD);
 
         /*
          * Force the boot properties of the eMMC device only when the
@@ -108,9 +109,8 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo 
*dinfo, bool emmc,
         }
         qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
                                 &error_fatal);
-        qdev_realize_and_unref(card,
-                               qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
-                               &error_fatal);
+        qdev_realize(card, qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
+                     &error_fatal);
 }
 
 void aspeed_connect_serial_hds_to_uarts(AspeedMachineState *bmc)
@@ -188,13 +188,13 @@ static void aspeed_machine_init(MachineState *machine)
     qdev_realize(DEVICE(bmc->soc), NULL, &error_abort);
 
     if (defaults_enabled()) {
-        aspeed_board_init_flashes(&bmc->soc->fmc,
+        aspeed_board_init_flashes(OBJECT(bmc), &bmc->soc->fmc,
                               bmc->fmc_model ? bmc->fmc_model : amc->fmc_model,
                               amc->num_cs, 0);
-        aspeed_board_init_flashes(&bmc->soc->spi[0],
+        aspeed_board_init_flashes(OBJECT(bmc), &bmc->soc->spi[0],
                               bmc->spi_model ? bmc->spi_model : amc->spi_model,
                               1, amc->num_cs);
-        aspeed_board_init_flashes(&bmc->soc->spi[1],
+        aspeed_board_init_flashes(OBJECT(bmc), &bmc->soc->spi[1],
                                   amc->spi2_model, 1, amc->num_cs2);
     }
 
@@ -219,7 +219,7 @@ static void aspeed_machine_init(MachineState *machine)
     }
 
     for (i = 0; i < bmc->soc->sdhci.num_slots && defaults_enabled(); i++) {
-        sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
+        sdhci_attach_drive(OBJECT(bmc), &bmc->soc->sdhci.slots[i],
                            drive_get(IF_SD, 0, i), false, false);
     }
 
@@ -227,7 +227,8 @@ static void aspeed_machine_init(MachineState *machine)
 
     if (bmc->soc->emmc.num_slots && defaults_enabled()) {
         emmc0 = drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots);
-        sdhci_attach_drive(&bmc->soc->emmc.slots[0], emmc0, true, boot_emmc);
+        sdhci_attach_drive(OBJECT(bmc), &bmc->soc->emmc.slots[0], emmc0,
+                           true, boot_emmc);
     }
 
     if (!bmc->mmio_exec) {
@@ -251,16 +252,20 @@ static void aspeed_machine_init(MachineState *machine)
     arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
 }
 
-void aspeed_create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
+void aspeed_create_pca9552(Object *parent, AspeedSoCState *soc, int bus_id,
+                           int addr)
 {
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, bus_id),
+    i2c_slave_create_simple(parent, "pca9552[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, bus_id),
                             TYPE_PCA9552, addr);
 }
 
-I2CSlave *aspeed_create_pca9554(AspeedSoCState *soc, int bus_id, int addr)
+I2CSlave *aspeed_create_pca9554(Object *parent, AspeedSoCState *soc,
+                                int bus_id, int addr)
 {
-    return i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
bus_id),
-                            TYPE_PCA9554, addr);
+    return i2c_slave_create_simple(parent, "pca9554[*]",
+                                   aspeed_i2c_get_bus(&soc->i2c, bus_id),
+                                   TYPE_PCA9554, addr);
 }
 
 static bool aspeed_get_mmio_exec(Object *obj, Error **errp)
diff --git a/hw/arm/aspeed_ast1040_evb.c b/hw/arm/aspeed_ast1040_evb.c
index fb83087b13..bbb1ebb104 100644
--- a/hw/arm/aspeed_ast1040_evb.c
+++ b/hw/arm/aspeed_ast1040_evb.c
@@ -56,7 +56,8 @@ static void ast1040_evb_i2c_init(AspeedMachineState *bmc)
 
     smbus_eeprom_init_one(OBJECT(bmc), aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                           eeprom_buf);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 
0x4d);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 0x4d);
 }
 
 static void aspeed_machine_ast1040_evb_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast10x0_evb.c b/hw/arm/aspeed_ast10x0_evb.c
index dc134b555c..5153cf7c55 100644
--- a/hw/arm/aspeed_ast10x0_evb.c
+++ b/hw/arm/aspeed_ast10x0_evb.c
@@ -40,16 +40,16 @@ static void aspeed_minibmc_machine_init(MachineState 
*machine)
     qdev_realize(DEVICE(bmc->soc), NULL, &error_abort);
 
     if (defaults_enabled()) {
-        aspeed_board_init_flashes(&bmc->soc->fmc,
+        aspeed_board_init_flashes(OBJECT(bmc), &bmc->soc->fmc,
                             bmc->fmc_model ? bmc->fmc_model : amc->fmc_model,
                             amc->num_cs,
                             0);
 
-        aspeed_board_init_flashes(&bmc->soc->spi[0],
+        aspeed_board_init_flashes(OBJECT(bmc), &bmc->soc->spi[0],
                             bmc->spi_model ? bmc->spi_model : amc->spi_model,
                             amc->num_cs, amc->num_cs);
 
-        aspeed_board_init_flashes(&bmc->soc->spi[1],
+        aspeed_board_init_flashes(OBJECT(bmc), &bmc->soc->spi[1],
                             bmc->spi_model ? bmc->spi_model : amc->spi_model,
                             amc->num_cs, (amc->num_cs * 2));
     }
@@ -74,7 +74,8 @@ static void ast1030_evb_i2c_init(AspeedMachineState *bmc)
                           eeprom_buf);
 
     /* U11 LM75 connects to SDA/SCL Group 2 by default */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 
0x4d);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 0x4d);
 }
 
 static void aspeed_minibmc_machine_ast1030_evb_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2400_palmetto.c b/hw/arm/aspeed_ast2400_palmetto.c
index 80f9c911b8..3ca52cc7a5 100644
--- a/hw/arm/aspeed_ast2400_palmetto.c
+++ b/hw/arm/aspeed_ast2400_palmetto.c
@@ -37,13 +37,15 @@ static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
      * The palmetto platform expects a ds3231 RTC but a ds1338 is
      * enough to provide basic RTC features. Alarms will be missing
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 
0x68);
+    i2c_slave_create_simple(OBJECT(bmc), "rtc",
+                            aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 0x68);
 
     smbus_eeprom_init_one(OBJECT(bmc), aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                           eeprom_buf);
 
     /* add a TMP423 temperature sensor */
-    dev = DEVICE(i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
2),
+    dev = DEVICE(i2c_slave_create_simple(OBJECT(bmc), "tmp423",
+                                         aspeed_i2c_get_bus(&soc->i2c, 2),
                                          "tmp423", 0x4c));
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
diff --git a/hw/arm/aspeed_ast2400_quanta-q71l.c 
b/hw/arm/aspeed_ast2400_quanta-q71l.c
index 802ae49604..cc358b9ecf 100644
--- a/hw/arm/aspeed_ast2400_quanta-q71l.c
+++ b/hw/arm/aspeed_ast2400_quanta-q71l.c
@@ -33,21 +33,27 @@ static void quanta_q71l_bmc_i2c_init(AspeedMachineState 
*bmc)
      * The quanta-q71l platform expects tmp75s which are compatible with
      * tmp105s.
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 
0x4c);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 
0x4e);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 
0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 0x4c);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 0x4e);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 1), "tmp105", 0x4f);
 
     /* TODO: i2c-1: Add baseboard FRU eeprom@54 24c64 */
     /* TODO: i2c-1: Add Frontpanel FRU eeprom@57 24c64 */
     /* TODO: Add Memory Riser i2c mux and eeproms. */
 
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 2), 
"pca9546", 0x74);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 2), 
"pca9548", 0x77);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 2), "pca9546", 0x74);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 2), "pca9548", 0x77);
 
     /* TODO: i2c-3: Add BIOS FRU eeprom@56 24c64 */
 
     /* i2c-7 */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 7), 
"pca9546", 0x70);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 7), "pca9546", 0x70);
     /*        - i2c@0: pmbus@59 */
     /*        - i2c@1: pmbus@58 */
     /*        - i2c@2: pmbus@58 */
diff --git a/hw/arm/aspeed_ast2400_supermicrox11.c 
b/hw/arm/aspeed_ast2400_supermicrox11.c
index b18adf3981..cabeb951f9 100644
--- a/hw/arm/aspeed_ast2400_supermicrox11.c
+++ b/hw/arm/aspeed_ast2400_supermicrox11.c
@@ -37,13 +37,15 @@ static void supermicrox11_bmc_i2c_init(AspeedMachineState 
*bmc)
      * The palmetto platform expects a ds3231 RTC but a ds1338 is
      * enough to provide basic RTC features. Alarms will be missing
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 
0x68);
+    i2c_slave_create_simple(OBJECT(bmc), "rtc",
+                            aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 0x68);
 
     smbus_eeprom_init_one(OBJECT(bmc), aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                           eeprom_buf);
 
     /* add a TMP423 temperature sensor */
-    dev = DEVICE(i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
2),
+    dev = DEVICE(i2c_slave_create_simple(OBJECT(bmc), "tmp423",
+                                         aspeed_i2c_get_bus(&soc->i2c, 2),
                                          "tmp423", 0x4c));
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
diff --git a/hw/arm/aspeed_ast2500_evb.c b/hw/arm/aspeed_ast2500_evb.c
index ba8a56bafd..933ffa087a 100644
--- a/hw/arm/aspeed_ast2500_evb.c
+++ b/hw/arm/aspeed_ast2500_evb.c
@@ -34,8 +34,9 @@ static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
                           eeprom_buf);
 
     /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 7),
-                     TYPE_TMP105, 0x4d);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 7),
+                            TYPE_TMP105, 0x4d);
 }
 
 static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2500_g220a.c b/hw/arm/aspeed_ast2500_g220a.c
index 27c9dc436a..c7c3e3efd3 100644
--- a/hw/arm/aspeed_ast2500_g220a.c
+++ b/hw/arm/aspeed_ast2500_g220a.c
@@ -32,19 +32,22 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
     AspeedSoCState *soc = bmc->soc;
     DeviceState *dev;
 
-    dev = DEVICE(i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
3),
+    dev = DEVICE(i2c_slave_create_simple(OBJECT(bmc), "emc1413[*]",
+                                         aspeed_i2c_get_bus(&soc->i2c, 3),
                                          "emc1413", 0x4c));
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
 
-    dev = DEVICE(i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
12),
+    dev = DEVICE(i2c_slave_create_simple(OBJECT(bmc), "emc1413[*]",
+                                         aspeed_i2c_get_bus(&soc->i2c, 12),
                                          "emc1413", 0x4c));
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
 
-    dev = DEVICE(i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
13),
+    dev = DEVICE(i2c_slave_create_simple(OBJECT(bmc), "emc1413[*]",
+                                         aspeed_i2c_get_bus(&soc->i2c, 13),
                                          "emc1413", 0x4c));
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
diff --git a/hw/arm/aspeed_ast2500_romulus.c b/hw/arm/aspeed_ast2500_romulus.c
index 1bbd2802f1..9abb69d6a1 100644
--- a/hw/arm/aspeed_ast2500_romulus.c
+++ b/hw/arm/aspeed_ast2500_romulus.c
@@ -30,7 +30,8 @@ static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
      * The romulus board expects Epson RX8900 I2C RTC but a ds1338 is
      * good enough
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 11), 
"ds1338", 0x32);
+    i2c_slave_create_simple(OBJECT(bmc), "rtc",
+                            aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
 }
 
 static void aspeed_machine_romulus_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2500_supermicro-x11spi.c 
b/hw/arm/aspeed_ast2500_supermicro-x11spi.c
index bea459eeaa..f20b2d5efb 100644
--- a/hw/arm/aspeed_ast2500_supermicro-x11spi.c
+++ b/hw/arm/aspeed_ast2500_supermicro-x11spi.c
@@ -33,13 +33,15 @@ static void 
supermicro_x11spi_bmc_i2c_init(AspeedMachineState *bmc)
      * The palmetto platform expects a ds3231 RTC but a ds1338 is
      * enough to provide basic RTC features. Alarms will be missing
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 
0x68);
+    i2c_slave_create_simple(OBJECT(bmc), "rtc",
+                            aspeed_i2c_get_bus(&soc->i2c, 0), "ds1338", 0x68);
 
     smbus_eeprom_init_one(OBJECT(bmc), aspeed_i2c_get_bus(&soc->i2c, 0), 0x50,
                           eeprom_buf);
 
     /* add a TMP423 temperature sensor */
-    dev = DEVICE(i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 
2),
+    dev = DEVICE(i2c_slave_create_simple(OBJECT(bmc), "tmp423",
+                                         aspeed_i2c_get_bus(&soc->i2c, 2),
                                          "tmp423", 0x4c));
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
diff --git a/hw/arm/aspeed_ast2500_tiogapass.c 
b/hw/arm/aspeed_ast2500_tiogapass.c
index a6b3c0d051..13d1db9cfa 100644
--- a/hw/arm/aspeed_ast2500_tiogapass.c
+++ b/hw/arm/aspeed_ast2500_tiogapass.c
@@ -55,9 +55,12 @@ static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
     at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * KiB,
                           tiogapass_bmc_fruid, tiogapass_bmc_fruid_len);
     /* TMP421 */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 8), "tmp421", 
0x1f);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 
0x4f);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 
0x4e);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 8), "tmp421", 0x1f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 6), "tmp421", 0x4e);
 }
 
 static void aspeed_machine_tiogapass_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2500_witherspoon.c 
b/hw/arm/aspeed_ast2500_witherspoon.c
index dda090ab60..2ba7ebb461 100644
--- a/hw/arm/aspeed_ast2500_witherspoon.c
+++ b/hw/arm/aspeed_ast2500_witherspoon.c
@@ -44,11 +44,9 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
     LEDState *led;
 
     /* Bus 3: TODO bmp280@77 */
-    dev = DEVICE(i2c_slave_new_orphan(TYPE_PCA9552, 0x60));
+    dev = DEVICE(i2c_slave_new(OBJECT(bmc), "pca9552[*]", TYPE_PCA9552, 0x60));
     qdev_prop_set_string(dev, "description", "pca1");
-    i2c_slave_realize_and_unref(I2C_SLAVE(dev),
-                                aspeed_i2c_get_bus(&soc->i2c, 3),
-                                &error_fatal);
+    qdev_realize(dev, BUS(aspeed_i2c_get_bus(&soc->i2c, 3)), &error_fatal);
 
     for (size_t i = 0; i < ARRAY_SIZE(pca1_leds); i++) {
         led = led_create_simple(OBJECT(bmc),
@@ -58,28 +56,32 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState 
*bmc)
         qdev_connect_gpio_out(dev, pca1_leds[i].gpio_id,
                               qdev_get_gpio_in(DEVICE(led), 0));
     }
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 3), "dps310", 
0x76);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 3), 
"max31785", 0x52);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 
0x4c);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 
0x4c);
+    i2c_slave_create_simple(OBJECT(bmc), "dps310",
+                            aspeed_i2c_get_bus(&soc->i2c, 3), "dps310", 0x76);
+    i2c_slave_create_simple(OBJECT(bmc), "max31785",
+                            aspeed_i2c_get_bus(&soc->i2c, 3), "max31785", 
0x52);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp423[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp423[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c);
 
     /* The Witherspoon expects a TMP275 but a TMP105 is compatible */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 9), 
TYPE_TMP105,
-                     0x4a);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 9), TYPE_TMP105,
+                            0x4a);
 
     /*
      * The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is
      * good enough
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 11), 
"ds1338", 0x32);
+    i2c_slave_create_simple(OBJECT(bmc), "rtc",
+                            aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
 
     smbus_eeprom_init_one(OBJECT(bmc), aspeed_i2c_get_bus(&soc->i2c, 11), 0x51,
                           eeprom_buf);
-    dev = DEVICE(i2c_slave_new_orphan(TYPE_PCA9552, 0x60));
+    dev = DEVICE(i2c_slave_new(OBJECT(bmc), "pca9552[*]", TYPE_PCA9552, 0x60));
     qdev_prop_set_string(dev, "description", "pca0");
-    i2c_slave_realize_and_unref(I2C_SLAVE(dev),
-                                aspeed_i2c_get_bus(&soc->i2c, 11),
-                                &error_fatal);
+    qdev_realize(dev, BUS(aspeed_i2c_get_bus(&soc->i2c, 11)), &error_fatal);
     /* Bus 11: TODO ucd90160@64 */
 }
 
diff --git a/hw/arm/aspeed_ast2500_yosemitev2.c 
b/hw/arm/aspeed_ast2500_yosemitev2.c
index 905758c345..4e3c19bc07 100644
--- a/hw/arm/aspeed_ast2500_yosemitev2.c
+++ b/hw/arm/aspeed_ast2500_yosemitev2.c
@@ -55,9 +55,12 @@ static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
     at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
                           yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len);
     /* TMP421 */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 11), 
"tmp421", 0x1f);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 
0x4e);
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 
0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 11), "tmp421", 0x1f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4e);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            aspeed_i2c_get_bus(&soc->i2c, 9), "tmp421", 0x4f);
 
 }
 
diff --git a/hw/arm/aspeed_ast2600_bletchley.c 
b/hw/arm/aspeed_ast2600_bletchley.c
index 4930bddb39..58f0bc89bd 100644
--- a/hw/arm/aspeed_ast2600_bletchley.c
+++ b/hw/arm/aspeed_ast2600_bletchley.c
@@ -35,35 +35,44 @@ static void bletchley_bmc_i2c_init(AspeedMachineState *bmc)
     for (int i = 0; i < 6; i++) {
         /* Missing model: ti,ina230 @ 0x45 */
         /* Missing model: mps,mp5023 @ 0x40 */
-        i2c_slave_create_simple_orphan(i2c[i], TYPE_TMP421, 0x4f);
+        i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                                i2c[i], TYPE_TMP421, 0x4f);
         /* Missing model: nxp,pca9539 @ 0x76, but PCA9552 works enough */
-        i2c_slave_create_simple_orphan(i2c[i], TYPE_PCA9552, 0x76);
-        i2c_slave_create_simple_orphan(i2c[i], TYPE_PCA9552, 0x67);
+        i2c_slave_create_simple(OBJECT(bmc), "pca9552[*]",
+                                i2c[i], TYPE_PCA9552, 0x76);
+        i2c_slave_create_simple(OBJECT(bmc), "pca9552[*]",
+                                i2c[i], TYPE_PCA9552, 0x67);
         /* Missing model: fsc,fusb302 @ 0x22 */
     }
 
     /* Bus 6 */
     at24c_eeprom_init(i2c[6], 0x56, 65536);
     /* Missing model: nxp,pcf85263 @ 0x51 , but ds1338 works enough */
-    i2c_slave_create_simple_orphan(i2c[6], "ds1338", 0x51);
+    i2c_slave_create_simple(OBJECT(bmc), "rtc", i2c[6], "ds1338", 0x51);
 
 
     /* Bus 7 */
     at24c_eeprom_init(i2c[7], 0x54, 65536);
 
     /* Bus 9 */
-    i2c_slave_create_simple_orphan(i2c[9], TYPE_TMP421, 0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            i2c[9], TYPE_TMP421, 0x4f);
 
     /* Bus 10 */
-    i2c_slave_create_simple_orphan(i2c[10], TYPE_TMP421, 0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            i2c[10], TYPE_TMP421, 0x4f);
     /* Missing model: ti,hdc1080 @ 0x40 */
-    i2c_slave_create_simple_orphan(i2c[10], TYPE_PCA9552, 0x67);
+    i2c_slave_create_simple(OBJECT(bmc), "pca9552[*]",
+                            i2c[10], TYPE_PCA9552, 0x67);
 
     /* Bus 12 */
     /* Missing model: adi,adm1278 @ 0x11 */
-    i2c_slave_create_simple_orphan(i2c[12], TYPE_TMP421, 0x4c);
-    i2c_slave_create_simple_orphan(i2c[12], TYPE_TMP421, 0x4d);
-    i2c_slave_create_simple_orphan(i2c[12], TYPE_PCA9552, 0x67);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            i2c[12], TYPE_TMP421, 0x4c);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421[*]",
+                            i2c[12], TYPE_TMP421, 0x4d);
+    i2c_slave_create_simple(OBJECT(bmc), "pca9552[*]",
+                            i2c[12], TYPE_PCA9552, 0x67);
 }
 
 static void aspeed_machine_bletchley_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2600_evb.c b/hw/arm/aspeed_ast2600_evb.c
index ab7667da75..8e389dbe80 100644
--- a/hw/arm/aspeed_ast2600_evb.c
+++ b/hw/arm/aspeed_ast2600_evb.c
@@ -27,8 +27,9 @@ static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
                           eeprom_buf);
 
     /* LM75 is compatible with TMP105 driver */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 8),
-                     TYPE_TMP105, 0x4d);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 8),
+                            TYPE_TMP105, 0x4d);
 }
 
 static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc,
diff --git a/hw/arm/aspeed_ast2600_fby35.c b/hw/arm/aspeed_ast2600_fby35.c
index fcd1acdc17..dedc273ee3 100644
--- a/hw/arm/aspeed_ast2600_fby35.c
+++ b/hw/arm/aspeed_ast2600_fby35.c
@@ -102,12 +102,12 @@ static void fby35_i2c_init(AspeedMachineState *bmc)
         i2c[i] = aspeed_i2c_get_bus(&soc->i2c, i);
     }
 
-    i2c_slave_create_simple_orphan(i2c[2], TYPE_LM75, 0x4f);
-    i2c_slave_create_simple_orphan(i2c[8], TYPE_TMP421, 0x1f);
+    i2c_slave_create_simple(OBJECT(bmc), "lm75[*]", i2c[2], TYPE_LM75, 0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "tmp421", i2c[8], TYPE_TMP421, 0x1f);
     /* Hotswap controller is actually supposed to be mp5920 or ltc4282. */
-    i2c_slave_create_simple_orphan(i2c[11], "adm1272", 0x44);
-    i2c_slave_create_simple_orphan(i2c[12], TYPE_LM75, 0x4e);
-    i2c_slave_create_simple_orphan(i2c[12], TYPE_LM75, 0x4f);
+    i2c_slave_create_simple(OBJECT(bmc), "adm1272", i2c[11], "adm1272", 0x44);
+    i2c_slave_create_simple(OBJECT(bmc), "lm75[*]", i2c[12], TYPE_LM75, 0x4e);
+    i2c_slave_create_simple(OBJECT(bmc), "lm75[*]", i2c[12], TYPE_LM75, 0x4f);
 
     at24c_eeprom_init(i2c[4], 0x51, 128 * KiB);
     at24c_eeprom_init(i2c[6], 0x51, 128 * KiB);
diff --git a/hw/arm/aspeed_ast2600_gb200nvl.c b/hw/arm/aspeed_ast2600_gb200nvl.c
index 2c1c513674..1cf35f96bd 100644
--- a/hw/arm/aspeed_ast2600_gb200nvl.c
+++ b/hw/arm/aspeed_ast2600_gb200nvl.c
@@ -51,23 +51,23 @@ static void gb200nvl_bmc_i2c_init(AspeedMachineState *bmc)
     }
 
     /* Bus 5 Expander */
-    aspeed_create_pca9554(soc, 4, 0x21);
+    aspeed_create_pca9554(OBJECT(bmc), soc, 4, 0x21);
 
     /* Mux I2c Expanders */
-    i2c_slave_create_simple_orphan(i2c[5], "pca9546", 0x71);
-    i2c_slave_create_simple_orphan(i2c[5], "pca9546", 0x72);
-    i2c_slave_create_simple_orphan(i2c[5], "pca9546", 0x73);
-    i2c_slave_create_simple_orphan(i2c[5], "pca9546", 0x75);
-    i2c_slave_create_simple_orphan(i2c[5], "pca9546", 0x76);
-    i2c_slave_create_simple_orphan(i2c[5], "pca9546", 0x77);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]", i2c[5], "pca9546", 
0x71);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]", i2c[5], "pca9546", 
0x72);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]", i2c[5], "pca9546", 
0x73);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]", i2c[5], "pca9546", 
0x75);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]", i2c[5], "pca9546", 
0x76);
+    i2c_slave_create_simple(OBJECT(bmc), "i2c-mux[*]", i2c[5], "pca9546", 
0x77);
 
     /* Bus 10 */
-    dev = DEVICE(aspeed_create_pca9554(soc, 9, 0x20));
+    dev = DEVICE(aspeed_create_pca9554(OBJECT(bmc), soc, 9, 0x20));
 
     /* Set FPGA_READY */
     object_property_set_str(OBJECT(dev), "pin1", "high", &error_fatal);
 
-    aspeed_create_pca9554(soc, 9, 0x21);
+    aspeed_create_pca9554(OBJECT(bmc), soc, 9, 0x21);
     at24c_eeprom_init(i2c[9], 0x50, 64 * KiB);
     at24c_eeprom_init(i2c[9], 0x51, 64 * KiB);
 
diff --git a/hw/arm/aspeed_ast2600_rainier.c b/hw/arm/aspeed_ast2600_rainier.c
index 0495c2880c..8ba15aceca 100644
--- a/hw/arm/aspeed_ast2600_rainier.c
+++ b/hw/arm/aspeed_ast2600_rainier.c
@@ -70,7 +70,7 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
 
     at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, 32 * KiB);
 
-    aspeed_create_pca9552(soc, 3, 0x61);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 3, 0x61);
 
     /* The rainier expects a TMP275 but a TMP105 is compatible */
     i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 4), 
TYPE_TMP105,
@@ -84,14 +84,14 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x52, 64 * KiB);
-    aspeed_create_pca9552(soc, 4, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 4, 0x60);
 
     i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 5), 
TYPE_TMP105,
                      0x48);
     i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 5), 
TYPE_TMP105,
                      0x49);
-    aspeed_create_pca9552(soc, 5, 0x60);
-    aspeed_create_pca9552(soc, 5, 0x61);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 5, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 5, 0x61);
     i2c_mux = i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 5),
                                       "pca9546", 0x70);
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
@@ -110,12 +110,12 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x50, 64 * KiB);
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 0x51, 64 * KiB);
 
-    aspeed_create_pca9552(soc, 7, 0x30);
-    aspeed_create_pca9552(soc, 7, 0x31);
-    aspeed_create_pca9552(soc, 7, 0x32);
-    aspeed_create_pca9552(soc, 7, 0x33);
-    aspeed_create_pca9552(soc, 7, 0x60);
-    aspeed_create_pca9552(soc, 7, 0x61);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 7, 0x30);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 7, 0x31);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 7, 0x32);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 7, 0x33);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 7, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 7, 0x61);
     i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 7), "dps310", 
0x76);
     /* Bus 7: TODO si7021-a20@20 */
     i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 7), 
TYPE_TMP105,
@@ -132,8 +132,8 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
                           64 * KiB, rainier_bb_fruid, rainier_bb_fruid_len);
     at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51,
                           64 * KiB, rainier_bmc_fruid, rainier_bmc_fruid_len);
-    aspeed_create_pca9552(soc, 8, 0x60);
-    aspeed_create_pca9552(soc, 8, 0x61);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 8, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 8, 0x61);
     /* Bus 8: ucd90320@11 */
     /* Bus 8: ucd90320@b */
     /* Bus 8: ucd90320@c */
@@ -154,17 +154,17 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
                                       "pca9546", 0x70);
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
     at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
-    aspeed_create_pca9552(soc, 11, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 11, 0x60);
 
 
     at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, 64 * KiB);
-    aspeed_create_pca9552(soc, 13, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 13, 0x60);
 
     at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 14), 0x50, 64 * KiB);
-    aspeed_create_pca9552(soc, 14, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 14, 0x60);
 
     at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 15), 0x50, 64 * KiB);
-    aspeed_create_pca9552(soc, 15, 0x60);
+    aspeed_create_pca9552(OBJECT(bmc), soc, 15, 0x60);
 }
 
 static void aspeed_machine_rainier_class_init(ObjectClass *oc, const void 
*data)
diff --git a/hw/arm/aspeed_ast27x0-fc.c b/hw/arm/aspeed_ast27x0-fc.c
index f21c842315..74626973bc 100644
--- a/hw/arm/aspeed_ast27x0-fc.c
+++ b/hw/arm/aspeed_ast27x0-fc.c
@@ -109,10 +109,13 @@ static bool ast2700fc_ca35_init(MachineState *machine, 
Error **errp)
     /*
      * AST2700 EVB has a LM75 temperature sensor on I2C bus 0 at address 0x4d.
      */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 0), "tmp105", 
0x4d);
+    i2c_slave_create_simple(OBJECT(machine), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 0), "tmp105", 0x4d);
 
-    aspeed_board_init_flashes(&soc->fmc, AST2700FC_FMC_MODEL, 2, 0);
-    aspeed_board_init_flashes(&soc->spi[0], AST2700FC_SPI_MODEL, 1, 2);
+    aspeed_board_init_flashes(OBJECT(machine), &soc->fmc,
+                              AST2700FC_FMC_MODEL, 2, 0);
+    aspeed_board_init_flashes(OBJECT(machine), &soc->spi[0],
+                              AST2700FC_SPI_MODEL, 1, 2);
 
     ast2700fc_board_info.ram_size = machine->ram_size;
     ast2700fc_board_info.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
diff --git a/hw/arm/aspeed_ast27x0_evb.c b/hw/arm/aspeed_ast27x0_evb.c
index a59714372d..1892a59cce 100644
--- a/hw/arm/aspeed_ast27x0_evb.c
+++ b/hw/arm/aspeed_ast27x0_evb.c
@@ -24,7 +24,8 @@ static void ast2700_evb_i2c_init(AspeedMachineState *bmc)
     AspeedSoCState *soc = bmc->soc;
 
     /* LM75 is compatible with TMP105 driver */
-    i2c_slave_create_simple_orphan(aspeed_i2c_get_bus(&soc->i2c, 0),
+    i2c_slave_create_simple(OBJECT(bmc), "tmp105",
+                            aspeed_i2c_get_bus(&soc->i2c, 0),
                             TYPE_TMP105, 0x4d);
 }
 
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
index 33f7f10531..780a9659cc 100644
--- a/hw/arm/aspeed_soc_common.c
+++ b/hw/arm/aspeed_soc_common.c
@@ -81,11 +81,12 @@ bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp)
      * SoC has.
      */
     if (ram_size < max_ram_size) {
-        DeviceState *dev = qdev_new_orphan(TYPE_UNIMPLEMENTED_DEVICE);
+        DeviceState *dev = qdev_new(OBJECT(s), "ram-empty",
+                                    TYPE_UNIMPLEMENTED_DEVICE);
 
         qdev_prop_set_string(dev, "name", "ram-empty");
         qdev_prop_set_uint64(dev, "size", max_ram_size  - ram_size);
-        if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp)) {
+        if (!sysbus_realize(SYS_BUS_DEVICE(dev), errp)) {
             return false;
         }
 
@@ -115,7 +116,8 @@ void aspeed_mmio_map_unimplemented(MemoryRegion *memory, 
SysBusDevice *dev,
                                         sysbus_mmio_get_region(dev, 0), -1000);
 }
 
-void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
+void aspeed_board_init_flashes(Object *parent, AspeedSMCState *s,
+                               const char *flashtype,
                                unsigned int count, int unit0)
 {
     int i;
@@ -128,12 +130,12 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const 
char *flashtype,
         DriveInfo *dinfo = drive_get(IF_MTD, 0, unit0 + i);
         DeviceState *dev;
 
-        dev = qdev_new_orphan(flashtype);
+        dev = qdev_new(parent, "flash[*]", flashtype);
         if (dinfo) {
             qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
         }
         qdev_prop_set_uint8(dev, "cs", i);
-        qdev_realize_and_unref(dev, BUS(s->spi), &error_fatal);
+        qdev_realize(dev, BUS(s->spi), &error_fatal);
     }
 }
 
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index e1c0323cb6..743f7282ae 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -83,9 +83,10 @@ void aspeed_machine_class_init_cpus_defaults(MachineClass 
*mc);
  *
  * Create and attach a PCA9552 LED controller device to the specified I2C bus
  * of the given Aspeed SoC. The device is instantiated using
- * i2c_slave_create_simple_orphan() with the PCA9552 device type.
+ * i2c_slave_create_simple() with the PCA9552 device type.
  */
-void aspeed_create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
+void aspeed_create_pca9552(Object *parent, AspeedSoCState *soc, int bus_id,
+                           int addr);
 
 /*
  * aspeed_create_pca9554:
@@ -95,11 +96,12 @@ void aspeed_create_pca9552(AspeedSoCState *soc, int bus_id, 
int addr);
  *
  * Create and attach a PCA9554 I/O expander to the specified I2C bus
  * of the given Aspeed SoC. The device is created via
- * i2c_slave_create_simple_orphan() and returned as an #I2CSlave pointer.
+ * i2c_slave_create_simple() and returned as an #I2CSlave pointer.
  *
  * Returns: a pointer to the newly created #I2CSlave instance.
  */
-I2CSlave *aspeed_create_pca9554(AspeedSoCState *soc, int bus_id, int addr);
+I2CSlave *aspeed_create_pca9554(Object *parent, AspeedSoCState *soc,
+                                int bus_id, int addr);
 
 /*
  * aspeed_machine_ast2600_class_emmc_init:
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 41dc04e293..d1ad82e00a 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -311,7 +311,8 @@ void aspeed_mmio_map(MemoryRegion *memory, SysBusDevice 
*dev, int n,
 void aspeed_mmio_map_unimplemented(MemoryRegion *memory, SysBusDevice *dev,
                                    const char *name, hwaddr addr,
                                    uint64_t size);
-void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
+void aspeed_board_init_flashes(Object *parent, AspeedSMCState *s,
+                               const char *flashtype,
                                unsigned int count, int unit0);
 void aspeed_write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
                            Error **errp);
-- 
2.47.1


Reply via email to