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]>
---
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
@@ -73,25 +73,18 @@ struct RegisterAccessInfo {
*
* @opaque: Opaque data for the register
*/
struct RegisterInfo {
- /* <private> */
- DeviceState parent_obj;
-
- /* <public> */
void *data;
int data_size;
const RegisterAccessInfo *access;
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
* modeled using the RegisterInfo structure.
*
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
@@ -256,13 +256,10 @@ static RegisterInfoArray *register_init_block(DeviceState
*owner,
for (i = 0; i < num; i++) {
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;
r->access = &rae[i];
r->opaque = owner;
@@ -316,26 +313,11 @@ void register_finalize_block(RegisterInfoArray *r_array)
{
g_free(r_array->r);
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
@@ -1866,12 +1866,10 @@ static int canfd_populate_regarray(XlnxVersalCANFDState
*s,
for (i = 0; i < num_rae; i++) {
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),
.access = &rae[i],
.opaque = OBJECT(s),
--
2.51.0