@@ -39,18 +39,6 @@ SpaprDrcType spapr_drc_type(SpaprDrc *drc)
return 1 << drck->typeshift;
}
-uint32_t spapr_drc_index(SpaprDrc *drc)
-{
- SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
-
- /* no set format for a drc index: it only needs to be globally
- * unique. this is how we encode the DRC type on bare-metal
- * however, so might as well do that here
- */
- return (drck->typeshift << DRC_INDEX_TYPE_SHIFT)
- | (drc->id & DRC_INDEX_ID_MASK);
-}
-
static void spapr_drc_release(SpaprDrc *drc)
{
SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
@@ -546,11 +534,20 @@ SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type,
uint32_t id)
{
SpaprDrc *drc = SPAPR_DR_CONNECTOR(object_new(type));
+ SpaprDrcClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
g_autofree char *prop_name = NULL;
drc->id = id;
drc->owner = owner;
- drc->index = spapr_drc_index(drc);
+
+ /*
+ * No set format for a drc index: it only needs to be globally
+ * unique. This is how we encode the DRC type on bare-metal
+ * however, so might as well do that here.
+ */
+ drc->index = (drck->typeshift << DRC_INDEX_TYPE_SHIFT) |
+ (drc->id & DRC_INDEX_ID_MASK);
+
prop_name = g_strdup_printf("dr-connector[%"PRIu32"]", drc->index);
object_property_add_child(owner, prop_name, OBJECT(drc));
object_unref(OBJECT(drc));
@@ -228,7 +228,6 @@ static inline bool spapr_drc_hotplugged(DeviceState *dev)
/* Returns true if an unplug request completed */
bool spapr_drc_reset(SpaprDrc *drc);
-uint32_t spapr_drc_index(SpaprDrc *drc);
SpaprDrcType spapr_drc_type(SpaprDrc *drc);
SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type,
The only remaining caller of this function is the initialization of drc->index in spapr_dr_connector_new(). Open code the body of the function inside spapr_dr_connector_new() and remove spapr_drc_index(). Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- hw/ppc/spapr_drc.c | 23 ++++++++++------------- include/hw/ppc/spapr_drc.h | 1 - 2 files changed, 10 insertions(+), 14 deletions(-)