Message ID | 20230203180914.49112-19-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw: Set QDev properties using QDev API (part 1/3) | expand |
On Sat, 04 Feb 2023 03:09:13 +0900, Philippe Mathieu-Daudé wrote: > > No need to use the low-level QOM API when an object > inherits from QDev. Directly use the QDev API to set > its properties. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/rx/rx-gdbsim.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c > index 47c17026c7..5d50f36877 100644 > --- a/hw/rx/rx-gdbsim.c > +++ b/hw/rx/rx-gdbsim.c > @@ -21,6 +21,7 @@ > #include "qemu/error-report.h" > #include "qemu/guest-random.h" > #include "qapi/error.h" > +#include "hw/qdev-properties.h" > #include "hw/loader.h" > #include "hw/rx/rx62n.h" > #include "sysemu/qtest.h" > @@ -99,12 +100,10 @@ static void rx_gdbsim_init(MachineState *machine) > > /* Initialize MCU */ > object_initialize_child(OBJECT(machine), "mcu", &s->mcu, rxc->mcu_name); > - object_property_set_link(OBJECT(&s->mcu), "main-bus", OBJECT(sysmem), > - &error_abort); > - object_property_set_uint(OBJECT(&s->mcu), "xtal-frequency-hz", > - rxc->xtal_freq_hz, &error_abort); > - object_property_set_bool(OBJECT(&s->mcu), "load-kernel", > - kernel_filename != NULL, &error_abort); > + qdev_prop_set_link(DEVICE(&s->mcu), "main-bus", OBJECT(sysmem)); > + qdev_prop_set_uint32(DEVICE(&s->mcu), "xtal-frequency-hz", > + rxc->xtal_freq_hz); > + qdev_prop_set_bit(DEVICE(&s->mcu), "load-kernel", kernel_filename != NULL); > > if (!kernel_filename) { > if (machine->firmware) { > -- > 2.38.1 > Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c index 47c17026c7..5d50f36877 100644 --- a/hw/rx/rx-gdbsim.c +++ b/hw/rx/rx-gdbsim.c @@ -21,6 +21,7 @@ #include "qemu/error-report.h" #include "qemu/guest-random.h" #include "qapi/error.h" +#include "hw/qdev-properties.h" #include "hw/loader.h" #include "hw/rx/rx62n.h" #include "sysemu/qtest.h" @@ -99,12 +100,10 @@ static void rx_gdbsim_init(MachineState *machine) /* Initialize MCU */ object_initialize_child(OBJECT(machine), "mcu", &s->mcu, rxc->mcu_name); - object_property_set_link(OBJECT(&s->mcu), "main-bus", OBJECT(sysmem), - &error_abort); - object_property_set_uint(OBJECT(&s->mcu), "xtal-frequency-hz", - rxc->xtal_freq_hz, &error_abort); - object_property_set_bool(OBJECT(&s->mcu), "load-kernel", - kernel_filename != NULL, &error_abort); + qdev_prop_set_link(DEVICE(&s->mcu), "main-bus", OBJECT(sysmem)); + qdev_prop_set_uint32(DEVICE(&s->mcu), "xtal-frequency-hz", + rxc->xtal_freq_hz); + qdev_prop_set_bit(DEVICE(&s->mcu), "load-kernel", kernel_filename != NULL); if (!kernel_filename) { if (machine->firmware) {
No need to use the low-level QOM API when an object inherits from QDev. Directly use the QDev API to set its properties. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/rx/rx-gdbsim.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)