Skip to content

Commit 46ea1be

Browse files
committed
qdev: Document qdev_unrealize()
Add a doc comment for qdev_unrealize(), to go with the new documentation for the realize part of the qdev lifecycle. Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-id: [email protected]
1 parent b51238e commit 46ea1be

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

include/hw/qdev-core.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,25 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp);
381381
* would be incorrect. For that use case you want qdev_realize().
382382
*/
383383
bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp);
384+
/**
385+
* qdev_unrealize: Unrealize a device
386+
* @dev: device to unrealize
387+
*
388+
* This function will "unrealize" a device, which is the first phase
389+
* of correctly destroying a device that has been realized. It will:
390+
*
391+
* - unrealize any child buses by calling qbus_unrealize()
392+
* (this will recursively unrealize any devices on those buses)
393+
* - call the the unrealize method of @dev
394+
*
395+
* The device can then be freed by causing its reference count to go
396+
* to zero.
397+
*
398+
* Warning: most devices in QEMU do not expect to be unrealized. Only
399+
* devices which are hot-unpluggable should be unrealized (as part of
400+
* the unplugging process); all other devices are expected to last for
401+
* the life of the simulation and should not be unrealized and freed.
402+
*/
384403
void qdev_unrealize(DeviceState *dev);
385404
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
386405
int required_for_version);

0 commit comments

Comments
 (0)