From: Luc Michel <[email protected]> The REGISTER class (RegisterInfo struct) is currently a QOM type inheriting from DEVICE. This class has no real purpose: - the qdev API is not used, - according to the comment preceding it, the object_initialize call is here to zero-initialize the struct. However all the effective struct attributes are then initialized explicitly. - the object is never parented.
This commits drops the REGISTER QOM type completely, leaving the RegisterInfo struct as a bare C struct. The register_register_types function is left empty here because it is reused in the next commit. Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Francisco Iglesias <[email protected]> Reviewed-by: Edgar E. Iglesias <[email protected]> Signed-off-by: Luc Michel <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- include/hw/register.h | 7 ------- hw/core/register.c | 18 ------------------ hw/net/can/xlnx-versal-canfd.c | 2 -- 3 files changed, 27 deletions(-) diff --git a/include/hw/register.h b/include/hw/register.h index a913c52aee5..4d13ea183c7 100644 --- a/include/hw/register.h +++ b/include/hw/register.h @@ -75,10 +75,6 @@ struct RegisterAccessInfo { */ struct RegisterInfo { - /* <private> */ - DeviceState parent_obj; - - /* <public> */ void *data; int data_size; @@ -87,9 +83,6 @@ struct RegisterInfo { void *opaque; }; -#define TYPE_REGISTER "qemu-register" -DECLARE_INSTANCE_CHECKER(RegisterInfo, REGISTER, - TYPE_REGISTER) /** * This structure is used to group all of the individual registers which are diff --git a/hw/core/register.c b/hw/core/register.c index 3340df70b06..2553cb15aba 100644 --- a/hw/core/register.c +++ b/hw/core/register.c @@ -258,9 +258,6 @@ static RegisterInfoArray *register_init_block(DeviceState *owner, int index = rae[i].addr / data_size; RegisterInfo *r = &ri[index]; - /* Init the register, this will zero it. */ - object_initialize((void *)r, sizeof(*r), TYPE_REGISTER); - /* Set the properties of the register */ r->data = data + data_size * index; r->data_size = data_size; @@ -318,24 +315,9 @@ void register_finalize_block(RegisterInfoArray *r_array) g_free(r_array); } -static void register_class_init(ObjectClass *oc, const void *data) -{ - DeviceClass *dc = DEVICE_CLASS(oc); - - /* Reason: needs to be wired up to work */ - dc->user_creatable = false; -} - -static const TypeInfo register_info = { - .name = TYPE_REGISTER, - .parent = TYPE_DEVICE, - .class_init = register_class_init, - .instance_size = sizeof(RegisterInfo), -}; static void register_register_types(void) { - type_register_static(®ister_info); } type_init(register_register_types) diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index 343348660b5..99bbdd7d3fe 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -1868,8 +1868,6 @@ static int canfd_populate_regarray(XlnxVersalCANFDState *s, int index = rae[i].addr / 4; RegisterInfo *r = &s->reg_info[index]; - object_initialize(r, sizeof(*r), TYPE_REGISTER); - *r = (RegisterInfo) { .data = &s->regs[index], .data_size = sizeof(uint32_t), -- 2.51.0
