All external callers now go through the parented usb_new()/
usb_create_simple(), ssi_create_peripheral(), i2c_slave_new()/
i2c_slave_create_simple() introduced earlier in the series.
Remove the transitional *_orphan() spellings.

The corresponding *_realize_and_unref() helpers stay for now: they
are still valid for callers that reach for object_new() directly
and hold a floating reference (qdev_device_add() being the primary
example one layer down).

Assisted-by: Kiro
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/i2c/core.c        | 18 ------------------
 hw/ssi/ssi.c         |  8 --------
 include/hw/i2c/i2c.h | 31 ++++---------------------------
 include/hw/ssi/ssi.h |  5 ++---
 include/hw/usb/usb.h |  9 ---------
 5 files changed, 6 insertions(+), 65 deletions(-)

diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index fba21fdfad..f333df3760 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -364,15 +364,6 @@ const VMStateDescription vmstate_i2c_slave = {
     }
 };
 
-I2CSlave *i2c_slave_new_orphan(const char *name, uint8_t addr)
-{
-    DeviceState *dev;
-
-    dev = qdev_new_orphan(name);
-    qdev_prop_set_uint8(dev, "address", addr);
-    return I2C_SLAVE(dev);
-}
-
 I2CSlave *i2c_slave_new(Object *parent, const char *id,
                         const char *type, uint8_t addr)
 {
@@ -398,15 +389,6 @@ bool i2c_slave_realize_and_unref(I2CSlave *dev, I2CBus 
*bus, Error **errp)
     return qdev_realize_and_unref(&dev->qdev, &bus->qbus, errp);
 }
 
-I2CSlave *i2c_slave_create_simple_orphan(I2CBus *bus, const char *name, 
uint8_t addr)
-{
-    I2CSlave *dev = i2c_slave_new_orphan(name, addr);
-
-    i2c_slave_realize_and_unref(dev, bus, &error_abort);
-
-    return dev;
-}
-
 static bool i2c_slave_match(I2CSlave *candidate, uint8_t address,
                             bool broadcast, I2CNodeList *current_devs)
 {
diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c
index 6031cde7b0..07188d87bb 100644
--- a/hw/ssi/ssi.c
+++ b/hw/ssi/ssi.c
@@ -147,14 +147,6 @@ DeviceState *ssi_create_peripheral(Object *parent, const 
char *id,
     return dev;
 }
 
-DeviceState *ssi_create_peripheral_orphan(SSIBus *bus, const char *name)
-{
-    DeviceState *dev = qdev_new_orphan(name);
-
-    ssi_realize_and_unref(dev, bus, &error_fatal);
-    return dev;
-}
-
 SSIBus *ssi_create_bus(DeviceState *parent, const char *name)
 {
     BusState *bus;
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 0bba1a7c20..c0829edf8f 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -154,17 +154,6 @@ uint8_t i2c_recv(I2CBus *bus);
 bool i2c_scan_bus(I2CBus *bus, uint8_t address, bool broadcast,
                   I2CNodeList *current_devs);
 
-/**
- * Create an I2C slave device on the heap.
- * @name: a device type name
- * @addr: I2C address of the slave when put on a bus
- *
- * This only initializes the device state structure and allows
- * properties to be set. Type @name must exist. The device still
- * needs to be realized. See qdev-core.h.
- */
-I2CSlave *i2c_slave_new_orphan(const char *name, uint8_t addr);
-
 /**
  * Create a parented I2C slave device on the heap.
  * @parent: the QOM parent
@@ -172,24 +161,12 @@ I2CSlave *i2c_slave_new_orphan(const char *name, uint8_t 
addr);
  * @type: I2C slave device type name
  * @addr: I2C address of the slave when put on a bus
  *
- * Like i2c_slave_new_orphan(), but the returned device is owned by
+ * Like i2c_slave_new(), but the returned device is owned by
  * @parent's child<> property.  Pair with qdev_realize().
  */
 I2CSlave *i2c_slave_new(Object *parent, const char *id,
                         const char *type, uint8_t addr);
 
-/**
- * Create and realize an I2C slave device on the heap.
- * @bus: I2C bus to put it on
- * @name: I2C slave device type name
- * @addr: I2C address of the slave when put on a bus
- *
- * Create the device state structure, initialize it, put it on the
- * specified @bus, and drop the reference to it (the device is realized).
- */
-I2CSlave *i2c_slave_create_simple_orphan(I2CBus *bus, const char *name,
-                                         uint8_t addr);
-
 /**
  * Create, parent and realize an I2C slave device on the heap.
  * @parent: the QOM parent
@@ -218,11 +195,11 @@ I2CSlave *i2c_slave_create_simple(Object *parent, const 
char *id,
  * Call 'realize' on @dev, put it on the specified @bus, and drop the
  * reference to it.
  *
- * This function is useful if you have created @dev via qdev_new_orphan(),
- * i2c_slave_new_orphan() or i2c_slave_try_new() (which take a reference to
+ * This function is useful if you have created @dev via qdev_new(),
+ * i2c_slave_new() or i2c_slave_try_new() (which take a reference to
  * the device it returns to you), so that you can set properties on it
  * before realizing it. If you don't need to set properties then
- * i2c_slave_create_simple_orphan() is probably better (as it does the create,
+ * i2c_slave_create_simple() is probably better (as it does the create,
  * init and realize in one step).
  *
  * If you are embedding the I2C slave into another QOM device and
diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h
index 36ed002281..b2a264bb55 100644
--- a/include/hw/ssi/ssi.h
+++ b/include/hw/ssi/ssi.h
@@ -83,7 +83,6 @@ extern const VMStateDescription vmstate_ssi_peripheral;
 
 DeviceState *ssi_create_peripheral(Object *parent, const char *id,
                                     SSIBus *bus, const char *type);
-DeviceState *ssi_create_peripheral_orphan(SSIBus *bus, const char *name);
 /**
  * ssi_realize_and_unref: realize and unref an SSI peripheral
  * @dev: SSI peripheral to realize
@@ -94,10 +93,10 @@ DeviceState *ssi_create_peripheral_orphan(SSIBus *bus, 
const char *name);
  * reference to it. Errors are reported via @errp and by returning
  * false.
  *
- * This function is useful if you have created @dev via qdev_new_orphan()
+ * This function is useful if you have created @dev via qdev_new()
  * (which takes a reference to the device it returns to you), so that
  * you can set properties on it before realizing it. If you don't need
- * to set properties then ssi_create_peripheral_orphan() is probably better 
(as it
+ * to set properties then ssi_create_peripheral() is probably better (as it
  * does the create, init and realize in one step).
  *
  * If you are embedding the SSI peripheral into another QOM device and
diff --git a/include/hw/usb/usb.h b/include/hw/usb/usb.h
index 1ae1f40aa9..d2e59bc83b 100644
--- a/include/hw/usb/usb.h
+++ b/include/hw/usb/usb.h
@@ -599,13 +599,4 @@ static inline USBDevice *usb_create_simple(Object *parent, 
const char *id,
     return dev;
 }
 
-static inline USBDevice *usb_create_simple_orphan(USBBus *bus,
-                                                    const char *name)
-{
-    USBDevice *dev = USB_DEVICE(qdev_new_orphan(name));
-
-    usb_realize_and_unref(dev, bus, &error_abort);
-    return dev;
-}
-
 #endif
-- 
2.47.1


Reply via email to