Skip to content

Commit

Permalink
include/hw: document the device_class_set_parent_* fns
Browse files Browse the repository at this point in the history
These are useful functions for when you want proper inheritance of
functionality across realize/unrealize calls.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230710153522.3469097-3-alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
stsquad authored and mstsirkin committed Jul 10, 2023
1 parent e57fc3d commit c378e88
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions include/hw/qdev-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,36 @@ void device_class_set_props(DeviceClass *dc, Property *props);
void device_class_set_parent_reset(DeviceClass *dc,
DeviceReset dev_reset,
DeviceReset *parent_reset);

/**
* device_class_set_parent_realize() - set up for chaining realize fns
* @dc: The device class
* @dev_realize: the device realize function
* @parent_realize: somewhere to save the parents realize function
*
* This is intended to be used when the new realize function will
* eventually call its parent realization function during creation.
* This requires storing the function call somewhere (usually in the
* instance structure) so you can eventually call
* dc->parent_realize(dev, errp)
*/
void device_class_set_parent_realize(DeviceClass *dc,
DeviceRealize dev_realize,
DeviceRealize *parent_realize);


/**
* device_class_set_parent_unrealize() - set up for chaining unrealize fns
* @dc: The device class
* @dev_unrealize: the device realize function
* @parent_unrealize: somewhere to save the parents unrealize function
*
* This is intended to be used when the new unrealize function will
* eventually call its parent unrealization function during the
* unrealize phase. This requires storing the function call somewhere
* (usually in the instance structure) so you can eventually call
* dc->parent_unrealize(dev);
*/
void device_class_set_parent_unrealize(DeviceClass *dc,
DeviceUnrealize dev_unrealize,
DeviceUnrealize *parent_unrealize);
Expand Down

0 comments on commit c378e88

Please sign in to comment.