Message ID | 20240216110313.17039-17-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw: More QDev cleanups | expand |
On 2024-02-16 12:03, Philippe Mathieu-Daudé wrote: > When the QOM parent is available, prefer object_initialize_child() > over object_initialize(), since it create the parent relationship. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> > --- > hw/net/can/xlnx-versal-canfd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c > index 47a14cfe63..f8e4bd75e4 100644 > --- a/hw/net/can/xlnx-versal-canfd.c > +++ b/hw/net/can/xlnx-versal-canfd.c > @@ -1900,7 +1900,7 @@ 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); > + object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER); > > *r = (RegisterInfo) { > .data = &s->regs[index],
On Friday 23 of February 2024 12:06:34 Francisco Iglesias wrote: > On 2024-02-16 12:03, Philippe Mathieu-Daudé wrote: > > When the QOM parent is available, prefer object_initialize_child() > > over object_initialize(), since it create the parent relationship. > > > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > > Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> Reviewed-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c index 47a14cfe63..f8e4bd75e4 100644 --- a/hw/net/can/xlnx-versal-canfd.c +++ b/hw/net/can/xlnx-versal-canfd.c @@ -1900,7 +1900,7 @@ 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); + object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER); *r = (RegisterInfo) { .data = &s->regs[index],
When the QOM parent is available, prefer object_initialize_child() over object_initialize(), since it create the parent relationship. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/net/can/xlnx-versal-canfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)